0 Votes

Changes for page MyWiki

Last modified by Ryan C on 2025/05/14 13:49

From version 9.1
edited by Ryan C
on 2025/04/28 06:25
Change comment: Rollback to version 4.1
To version 10.1
edited by Ryan C
on 2025/04/28 06:27
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,597 +1,329 @@
1 -= XWiki Macros Reference Guide {{id name="xwiki-macros-reference-guide" /}}=
1 += XWiki Macros Reference Guide =
2 2  
3 3  Macros in XWiki are reusable pieces of functionality that can be integrated inside pages. They allow you to insert dynamic content or apply special formatting using a simple syntax. Below is a list of available macros (excluding deprecated or internal macros) along with their descriptions and usage examples.
4 4  
5 -== Box Macro {{id name="box-macro" /}}==
6 6  
7 -The **Box** macro draws a box around the content inside it​:contentReference[oaicite:0]{index=0}. This is useful for highlighting important information or grouping related content in a styled panel.
6 +== TOC Macro ==
8 8  
9 -**Example:** A simple box with a custom title
8 +The **TOC** macro generates a Table of Contents.
10 10  
11 -**Note:** This is a sample box message.
12 -**Source:**
10 +{{example}}
11 +{{toc/}}
12 +{{/example}}
13 13  
14 +== Box Macro ==
14 14  
15 -{{code}}
16 -{{box title="Note"}} This is a sample box message. {{/box}}
17 -{{/code}}
16 +The **Box** macro draws a box around the content inside it. This is useful for highlighting important information or grouping related content in a styled panel.
18 18  
19 -== Info Macro {{id name="info-macro" /}}==
18 +{{example}}
19 +{{box title="Note"}}
20 +This is a sample box message.
21 +{{/box}}
22 +{{/example}}
20 20  
21 -The **Info** macro displays an informational message in a styled box format​:contentReference[oaicite:1]{index=1}. It is typically rendered with a distinctive color (often blue) to denote general information. This macro inherits all parameters from the Box macro​:contentReference[oaicite:2]{index=2} (such as the optional {{code}}title{{/code}}).
24 +== Info Macro ==
22 22  
23 -**Example:** An info message box
26 +The **Info** macro displays an informational message in a styled box. It is typically rendered with a blue color to denote general information.
24 24  
28 +{{example}}
29 +{{info}}
25 25  This is an informational message.
26 -**Source:**
31 +{{/info}}
32 +{{/example}}
27 27  
34 +{{example}}
35 +{{info title="FYI"}}
36 +This is an informational message with a title.
37 +{{/info}}
38 +{{/example}}
28 28  
29 -{{code}}
30 -{{info}}This is an informational message{{/info}}
31 -{{/code}}
40 +== Warning Macro ==
32 32  
33 -**Example (with title):** An info message with a title
42 +The **Warning** macro highlights a warning message in a styled box (yellow/orange background).
34 34  
35 -**FYI:** This is an informational message.
36 -**Source:**
37 -
38 -
39 -{{code}}
40 -{{info title="FYI"}} This is an informational message. {{/info}}
41 -{{/code}}
42 -
43 -== Warning Macro {{id name="warning-macro" /}}==
44 -
45 -The **Warning** macro highlights a warning message in a styled box (usually with a yellow/orange background)​:contentReference[oaicite:3]{index=3}. It inherits the same optional parameters as the Box macro (like {{code}}title{{/code}}).
46 -
47 -**Example:** A warning message box
48 -
44 +{{example}}
45 +{{warning}}
49 49  This is a warning message.
50 -**Source:**
47 +{{/warning}}
48 +{{/example}}
51 51  
50 +== Success Macro ==
52 52  
53 -{{code}}
54 -{{warning}}This is a warning message{{/warning}}
55 -{{/code}}
52 +The **Success** macro displays a success message in a green-styled box.
56 56  
57 -== Success Macro {{id name="success-macro" /}}==
58 -
59 -The **Success** macro displays a success message in a styled box (often green) to indicate a successful action or outcome​:contentReference[oaicite:4]{index=4}. Like other message macros, it supports the same parameters as the Box macro.
60 -
61 -**Example:** A success message box
62 -
54 +{{example}}
55 +{{success}}
63 63  This is a success message.
64 -**Source:**
57 +{{/success}}
58 +{{/example}}
65 65  
60 +== Error Macro ==
66 66  
67 -{{code}}
68 -{{success}}This is a success message{{/success}}
69 -{{/code}}
62 +The **Error** macro displays a critical error or alert message in a red-styled box.
70 70  
71 -== Error Macro {{id name="error-macro" /}}==
72 -
73 -The **Error** macro displays an error or alert message in a styled box (commonly red)​:contentReference[oaicite:5]{index=5}. It is used to draw attention to critical issues or errors. Like the info and warning macros, it also inherits Box macro parameters.
74 -
75 -**Example:** An error message box
76 -
64 +{{example}}
65 +{{error}}
77 77  This is an error message.
78 -**Source:**
67 +{{/error}}
68 +{{/example}}
79 79  
70 +== Chart Macro ==
80 80  
81 -{{code}}
82 -{{error}}This is an error message{{/error}}
83 -{{/code}}
72 +The **Chart** macro generates graphical charts based on input tables.
84 84  
85 -== Chart Macro {{id name="chart-macro" /}}==
74 +{{example}}
75 +{{chart type="pie" source="inline" params="range:B2-B4;series:columns;" width="400" height="300"}}
76 +|=Category|=Value|
77 +|A|10|
78 +|B|20|
79 +|C|30|
80 +{{/chart}}
81 +{{/example}}
86 86  
87 -The **Chart** macro generates a graphical chart (pie, bar, line, etc.) from provided data sources​:contentReference[oaicite:6]{index=6}. It can take data from an inline table or from an external source (another page, attachment, etc.), and supports various chart types through the {{code}}type{{/code}} parameter (e.g., pie, bar, line).
83 +{{example}}
84 +{{chart type="bar" source="inline" params="range:B2-C4;series:columns;" width="500" height="300"}}
85 +|=Quarter|=Product X|=Product Y|
86 +|Q1|20|15|
87 +|Q2|30|25|
88 +|Q3|25|30|
89 +{{/chart}}
90 +{{/example}}
88 88  
89 -**Example:** An inline pie chart
92 +== Children Macro ==
90 90  
91 -(This chart would show the distribution of three categories A, B, and C in a pie chart.)
94 +The **Children** macro lists the child pages of the current page.
92 92  
93 -**Source:**
94 -
95 -
96 -{{code}}
97 -{{chart type="pie" source="inline" params="range:B2-B4;series:columns;" width="400" height="300"}} |=Category|=Value| |A|10| |B|20| |C|30| {{/chart}}
98 -{{/code}}
99 -
100 -In the above example, a pie chart is created using an inline table as the data source. The table defines one category column and one value column, and the {{code}}series:columns{{/code}} parameter instructs the macro to treat each column of values as a data series​:contentReference[oaicite:7]{index=7}​:contentReference[oaicite:8]{index=8}.
101 -
102 -**Example (multi-series bar chart):** An inline bar chart comparing two data series
103 -
104 -(This chart would display a bar chart with categories Q1–Q3 on the X-axis, and two series "Product X" and "Product Y" as different colored bars.)
105 -
106 -**Source:**
107 -
108 -
109 -{{code}}
110 -{{chart type="bar" source="inline" params="range:B2-C4;series:columns;" width="500" height="300"}} |=Quarter|=Product X|=Product Y| |Q1|20|15| |Q2|30|25| |Q3|25|30| {{/chart}}
111 -{{/code}}
112 -
113 -Here we specify a bar chart with two series. The table provides three categories (Q1, Q2, Q3) and two value columns. The macro renders a grouped bar chart with two bars per category.
114 -
115 -== Children Macro {{id name="children-macro" /}}==
116 -
117 -The **Children** macro displays a list of child pages of the current page in a tree or list format​:contentReference[oaicite:9]{index=9}. It's useful for automatically listing sub-pages without manual updates.
118 -
119 -**Example:** Listing child pages
120 -
121 -*. [[Child Page 1>>#]]
122 -*. [[Child Page 2>>#]]
123 -
124 -**Source:**
125 -
126 -
127 -{{code}}
96 +{{example}}
128 128  {{children/}}
129 -{{/code}}
98 +{{/example}}
130 130  
131 -In this example, {{code}}{{children/}}{{/code}} would produce a bulleted list of links to all pages that are children of the current page.
100 +== Code Macro ==
132 132  
133 -== Code Macro {{id name="code-macro" /}}==
102 +The **Code** macro highlights and formats source code.
134 134  
135 -The **Code** macro formats and highlights a section of source code text. It supports many programming languages via syntax highlighting​:contentReference[oaicite:10]{index=10}, which can be specified with the {{code}}language{{/code}} parameter. By default, it will attempt to detect the language if not provided​:contentReference[oaicite:11]{index=11}. You can also choose to show line numbers by setting {{code}}layout="linenumbers"{{/code}}.
136 -
137 -**Example:** Highlighting a Java code snippet
138 -
139 -
140 -{{code}}
141 -// Java example public class Hello { public static void main(String[] args) { System.out.println("Hello World"); } }
104 +{{example}}
105 +{{code language="java"}}
106 +public class Hello {
107 + public static void main(String[] args) {
108 + System.out.println("Hello World");
109 + }
110 +}
142 142  {{/code}}
112 +{{/example}}
143 143  
144 -**Source:**
114 +== Comment Macro ==
145 145  
116 +The **Comment** macro hides content from page rendering.
146 146  
147 -{{code}}
148 -{{code language="java"}} public class Hello { public static void main(String[] args) { System.out.println("Hello World"); } } {{/code}}
149 -{{/code}}
118 +{{example}}
119 +Visible part 1.
120 +{{comment}}This text will not be visible.{{/comment}}
121 +Visible part 2.
122 +{{/example}}
150 150  
151 -In the rendered output, the code would be syntax-colored for Java. If you wanted to add line numbers to the code block, you could use {{code}}layout="linenumbers"{{/code}}, for example:
124 +== Container Macro ==
152 152  
126 +The **Container** macro creates multi-column layouts.
153 153  
154 -{{code}}
155 -{{code language="java" layout="linenumbers"}} ... code ... {{/code}}
156 -{{/code}}
128 +{{example}}
129 +{{container layoutStyle="columns"}}
130 +(((**Column 1:** This is the first column.)))
131 +(((**Column 2:** This is the second column.)))
132 +{{/container}}
133 +{{/example}}
157 157  
158 -== Comment Macro {{id name="comment-macro" /}}==
135 +== Dashboard Macro ==
159 159  
160 -The **Comment** macro allows putting comments in the wiki source that will not be displayed in the page output​:contentReference[oaicite:12]{index=12}. It's useful for leaving notes or temporarily hiding content. The content inside the comment macro is completely omitted when rendering the page.
137 +The **Dashboard** macro creates areas for gadgets.
161 161  
162 -**Example:** Using a comment to hide content
163 -
164 -Visible part 1. Visible part 2.
165 -**Source:**
166 -
167 -
168 -{{code}}
169 -Visible part 1. {{comment}}This text will not be visible{{/comment}} Visible part 2.
170 -{{/code}}
171 -
172 -In the above example, the text inside the {{code}}{{comment}}{{/code}} macro ("This text will not be visible") is omitted from the output, so the two visible parts appear consecutively as if the commented text wasn’t there.
173 -
174 -== Container Macro {{id name="container-macro" /}}==
175 -
176 -The **Container** macro groups content and applies a layout to it (such as arranging content in columns)​:contentReference[oaicite:13]{index=13}​:contentReference[oaicite:14]{index=14}. By default, it can implement a {{code}}columns{{/code}} layout (responsive, side-by-side columns) via {{code}}layoutStyle="columns"{{/code}}​:contentReference[oaicite:15]{index=15}. Content for each column is separated by wiki group markers {{code}}(((...))){{/code}} inside the macro.
177 -
178 -**Example:** Two-column layout
179 -
180 -|= |=
181 -|**Column 1:** This is the content of the first column. |**Column 2:** This is the content of the second column.
182 -
183 -**Source:**
184 -
185 -
186 -{{code}}
187 -{{container layoutStyle="columns"}} (((**Column 1:** This is the content of the first column.))) (((**Column 2:** This is the content of the second column.))) {{/container}}
188 -{{/code}}
189 -
190 -The above will render two columns of content. The container is responsive, so on a narrow screen the columns would stack vertically​:contentReference[oaicite:16]{index=16}. The triple parentheses {{code}}((...)){{/code}} are used to delineate each column’s content within the container macro.
191 -
192 -== Dashboard Macro {{id name="dashboard-macro" /}}==
193 -
194 -The **Dashboard** macro defines a dashboard area into which you can add gadgets​:contentReference[oaicite:17]{index=17}. It's commonly used on overview pages to lay out multiple gadgets in columns. The macro can take a {{code}}columns{{/code}} parameter to specify the number of gadget columns.
195 -
196 -**Example:** A dashboard with 2 columns
197 -
198 -//(Gadget area 1)//
199 -//(Gadget area 2)//
200 -**Source:**
201 -
202 -
203 -{{code}}
139 +{{example}}
204 204  {{dashboard columns="2"/}}
205 -{{/code}}
141 +{{/example}}
206 206  
207 -In practice, you would add gadgets (such as activity streams, charts, etc.) to the dashboard through the UI. The macro itself mainly sets up the layout for those gadgets.
143 +== Display Macro ==
208 208  
209 -== Display Macro {{id name="display-macro" /}}==
145 +The **Display** macro embeds content from another page.
210 210  
211 -The **Display** macro includes the rendered content of another page into the current page​:contentReference[oaicite:18]{index=18}. Unlike the Include macro, it inserts the output as if viewing that page, preserving its internal links and references​:contentReference[oaicite:19]{index=19}. Use this when you want to embed a page's content exactly as it appears on its own.
212 -
213 -**Example:** Display another page’s content
214 -
215 -**Source:**
216 -
217 -
218 -{{code}}
147 +{{example}}
219 219  {{display page="Help.Macros"/}}
220 -{{/code}}
149 +{{/example}}
221 221  
222 -This will insert the rendered content of the //Help.Macros// page at this location. All headings, images, and links from that page will appear as they do on the original page.
151 +== DisplayIcon Macro ==
223 223  
224 -== DisplayIcon Macro {{id name="displayicon-macro" /}}==
153 +The **DisplayIcon** macro displays an icon.
225 225  
226 -The **DisplayIcon** macro inserts an icon from the XWiki icon set into the page​:contentReference[oaicite:20]{index=20}. You specify the icon by its name (and optionally the icon set if different from the default).
227 -
228 -**Example:** Inserting a “home” icon
229 -
230 -🏠 Home
231 -**Source:**
232 -
233 -
234 -{{code}}
155 +{{example}}
235 235  {{displayIcon name="home"/}} Home
236 -{{/code}}
157 +{{/example}}
237 237  
238 -In this example, the macro {{code}}{{displayIcon name="home"/}}{{/code}} outputs a home icon (the little house symbol before the word "Home"). You can change the {{code}}name{{/code}} to any available icon name in your wiki’s icon theme (for example, {{code}}user{{/code}}, {{code}}document{{/code}}, etc.).
159 +== Documents Macro ==
239 239  
240 -== Documents Macro {{id name="documents-macro" /}}==
161 +The **Documents** macro shows a livetable of documents.
241 241  
242 -The **Documents** macro displays a list of pages in a livetable (a dynamic, filterable table of results)​:contentReference[oaicite:21]{index=21}. By default it can show all pages, but you can filter to a specific space or other criteria using parameters.
243 -
244 -**Example:** Listing all pages in a space
245 -
246 -|=Page |=Modified
247 -|[[Page1>>#]] |2025/04/15
248 -|[[Page2>>#]] |2025/04/10
249 -
250 -**Source:**
251 -
252 -
253 -{{code}}
163 +{{example}}
254 254  {{documents space="MySpace"/}}
255 -{{/code}}
165 +{{/example}}
256 256  
257 -This will create a livetable listing all pages in the //MySpace// space, with columns such as page name and last modified date. The table allows sorting and filtering (as it’s a livetable). If you omit the {{code}}space{{/code}} parameter, the macro might list pages from the whole wiki (use with caution on large wikis).
167 +== DocumentTree Macro ==
258 258  
259 -== DocumentTree Macro {{id name="documenttree-macro" /}}==
169 +The **DocumentTree** macro shows a collapsible page tree.
260 260  
261 -The **DocumentTree** macro displays a collapsible tree of pages​:contentReference[oaicite:22]{index=22}. It’s often used for navigation menus or page indexes. By default, it shows the page hierarchy of the current wiki, but you can specify a different root.
262 -
263 -**Example:** Page tree starting from a given page
264 -
265 -*. **Help (space)**
266 -**. Getting Started
267 -**. Macros
268 -***. Examples
269 -***. Reference
270 -
271 -**Source:**
272 -
273 -
274 -{{code}}
171 +{{example}}
275 275  {{documentTree reference="Help.WebHome"/}}
276 -{{/code}}
173 +{{/example}}
277 277  
278 -In the above example, the tree would start at the //Help// space’s home page and display its descendants. The user can expand/collapse branches. If no reference is specified, the macro may display the entire wiki’s page structure by default.
175 +== Footnote Macro ==
279 279  
280 -== Footnote Macro {{id name="footnote-macro" /}}==
177 +The **Footnote** macro adds footnotes to the page.
281 281  
282 -The **Footnote** macro inserts a footnote marker and text that will be collected and displayed at the bottom of the page​:contentReference[oaicite:23]{index=23} (or at the position of a {{code}}putFootnotes{{/code}} macro). Each footnote will be automatically numbered.
179 +{{example}}
180 +This is a statement{{footnote}}Source: Example Reference{{/footnote}}.
181 +{{putFootnotes/}}
182 +{{/example}}
283 283  
284 -**Example:** Adding a footnote to a sentence
184 +== PutFootnotes Macro ==
285 285  
286 -This is a statement^^[1]^^ with a reference.\\[1] Source: Example Reference
287 -**Source:**
186 +The **PutFootnotes** macro outputs collected footnotes.
288 288  
188 +{{example}}
189 +...page content...
190 +{{putFootnotes/}}
191 +{{/example}}
289 289  
290 -{{code}}
291 -This is a statement{{footnote}}Source: Example Reference{{/footnote}} with a reference. {{putFootnotes/}}
292 -{{/code}}
193 +== Gallery Macro ==
293 293  
294 -In the above example, the text inside {{code}}{{footnote}}{{/code}} (“Source: Example Reference”) will appear as a numbered footnote at the bottom of the page. The {{code}}{{putFootnotes/}}{{/code}} macro (used here at the end) outputs the collected footnotes. If {{code}}putFootnotes{{/code}} is not explicitly used, all footnotes are automatically shown at the end of the page by default​:contentReference[oaicite:24]{index=24}.
195 +The **Gallery** macro displays a collection of images.
295 295  
296 -== PutFootnotes Macro {{id name="putfootnotes-macro" /}}==
197 +{{example}}
198 +{{gallery}}
199 +image:Space.Page@Image1.png
200 +image:Space.Page@Image2.png
201 +{{/gallery}}
202 +{{/example}}
297 297  
298 -The **PutFootnotes** macro outputs all accumulated footnotes in the page at the location where it is placed​:contentReference[oaicite:25]{index=25}. If this macro is not used, footnotes will appear automatically at the very end of the page by default.
204 +== Groovy Macro ==
299 299  
300 -**Example:** Placing footnotes at a custom location
206 +The **Groovy** macro executes Groovy scripts.
301 301  
302 -**Source:**
208 +{{example}}
209 +{{groovy}}
210 +println("Hello from Groovy!")
211 +{{/groovy}}
212 +{{/example}}
303 303  
214 +== HTML Macro ==
304 304  
305 -{{code}}
306 -... page content ... {{putFootnotes/}}
307 -{{/code}}
216 +The **HTML** macro embeds raw HTML into pages.
308 308  
309 -Typically, you would put {{code}}{{putFootnotes/}}{{/code}} at the bottom of your content (or wherever you want the footnotes to appear). It will generate a list of all footnotes added via the {{code}}{{footnote}}{{/code}} macro in the text.
218 +{{example}}
219 +{{html}}
220 +<p style="color:red;">This is red text via HTML.</p>
221 +{{/html}}
222 +{{/example}}
310 310  
311 -== Gallery Macro {{id name="gallery-macro" /}}==
224 +== Id Macro ==
312 312  
313 -The **Gallery** macro displays a collection of images as a gallery or slide-show view​:contentReference[oaicite:26]{index=26}. You supply the images in the macro content (as image references or attachments), and the macro will present them with navigation controls.
226 +The **Id** macro defines an internal link anchor.
314 314  
315 -**Example:** A simple image gallery
228 +{{example}}
229 +Click [[here>>#myanchor]] to jump.
316 316  
317 -[[image:https://www.xwiki.org/logo.png||alt="Image1"]] [[image:https://www.xwiki.org/logo.png||alt="Image2"]]
318 -(Images displayed in a gallery with navigation controls)
231 +{{id name="myanchor"/}}
232 +**Target Location:** You have reached the target.
233 +{{/example}}
319 319  
320 -**Source:**
235 +== Include Macro ==
321 321  
237 +The **Include** macro includes another page's content.
322 322  
323 -{{code}}
324 -{{gallery}} image:Space.Page@Image1.png image:Space.Page@Image2.png {{/gallery}}
325 -{{/code}}
326 -
327 -In this example, two images (Image1.png and Image2.png from //Space.Page//) will be displayed in a gallery. In view mode, the gallery macro would show the first image with controls to navigate to the next image, or it might display thumbnails of both depending on configuration. You can include images from attachments (using {{code}}image:Page@file{{/code}} syntax) or external images (using {{code}}image:http://...{{/code}}).
328 -
329 -== Groovy Macro {{id name="groovy-macro" /}}==
330 -
331 -The **Groovy** macro executes a Groovy script on the server side​:contentReference[oaicite:27]{index=27}. This macro requires programming rights on the wiki, as it can perform advanced operations. It’s often used to manipulate or retrieve data and then output results in the page.
332 -
333 -**Example:** A simple Groovy script printing a message
334 -
335 -{{code}}Hello from Groovy!{{/code}}
336 -**Source:**
337 -
338 -
339 -{{code}}
340 -{{groovy}} println("Hello from Groovy!"); {{/groovy}}
341 -{{/code}}
342 -
343 -**Example:** Using Groovy to access XWiki API
344 -
345 -{{code}}This page is: {{/code}}//{{code}}Sample.Page{{/code}}//
346 -**Source:**
347 -
348 -
349 -{{code}}
350 -{{groovy}} def doc = xcontext.getDoc(); println("This page is: " + doc.getFullName()); {{/groovy}}
351 -{{/code}}
352 -
353 -In the second example, the Groovy script obtains the current document and prints its full name. Groovy scripts can use XWiki's API (via {{code}}xwiki{{/code}}, {{code}}xcontext{{/code}}, etc.) to interact with the wiki.
354 -
355 -== HTML Macro {{id name="html-macro" /}}==
356 -
357 -The **HTML** macro allows inserting raw HTML or XHTML content directly into a wiki page​:contentReference[oaicite:28]{index=28}. This is useful for embedding external widgets or custom HTML that the wiki syntax doesn’t support. (Using this macro may require programming rights to avoid security risks such as XSS.)
358 -
359 -**Example:** Inserting a custom HTML snippet
360 -
361 -This is red text via HTML.
362 -**Source:**
363 -
364 -
365 -{{code}}
366 -{{html}} This is red text via HTML. {{/html}}
367 -{{/code}}
368 -
369 -**Example:** Embedding an iframe (e.g., a YouTube video)
370 -
371 -
372 -**Source:**
373 -
374 -
375 -{{code}}
376 -{{html}} {{/html}}
377 -{{/code}}
378 -
379 -In the above, the HTML macro is used to embed a video player by directly writing an {{code}}<iframe>{{/code}} tag. The wiki will include that HTML as-is in the rendered page.
380 -
381 -== Id Macro {{id name="id-macro" /}}==
382 -
383 -The **Id** macro defines an anchor in the page that you can link to​:contentReference[oaicite:29]{index=29}. It is similar to an HTML anchor {{code}}<a id="..."></a>{{/code}}. This is helpful for creating link targets (for example, for internal page navigation).
384 -
385 -**Example:** Creating and linking to an anchor
386 -
387 -Click [[here>>#myanchor]] to jump. ...\\{{id name="myanchor" /}}**Target Location:** You have reached the target.
388 -**Source:**
389 -
390 -
391 -{{code}}
392 -Click [[here>>#myanchor]] to jump. ... {{id name="myanchor"/}}**Target Location:** You have reached the target.
393 -{{/code}}
394 -
395 -In this example, the {{code}}{{id name="myanchor"/}}{{/code}} macro defines an anchor named "myanchor" right before the "Target Location" text. The link {{code}}[[here>>#myanchor]]{{/code}} will scroll to that location when clicked.
396 -
397 -== Include Macro {{id name="include-macro" /}}==
398 -
399 -The **Include** macro includes the content of another wiki page into the current page, as if it were written here​:contentReference[oaicite:30]{index=30}. By default, it acts as if the included content is part of the current page (e.g., relative links in the included content won’t resolve to the original page)​:contentReference[oaicite:31]{index=31}.
400 -
401 -**Example:** Including a page
402 -
403 -**Source:**
404 -
405 -
406 -{{code}}
239 +{{example}}
407 407  {{include page="Help.Introduction"/}}
408 -{{/code}}
241 +{{/example}}
409 409  
410 -This will insert the content of the //Help.Introduction// page in-line. If that page has section anchors or relative image links, they might need special handling because the included content is merged into the current page context. If you want to include the fully rendered page instead, consider using the {{code}}display{{/code}} macro.
243 +== Mention Macro ==
411 411  
412 -**Example:** Including a specific section of a page
245 +The **Mention** macro notifies a mentioned user.
413 413  
414 -**Source:**
415 -
416 -
417 -{{code}}
418 -{{include page="Help.Macros" section="HExamples"/}}
419 -{{/code}}
420 -
421 -Here only the section of //Help.Macros// with the heading "Examples" (and its subcontent) will be included. The {{code}}section{{/code}} parameter uses the anchor name of the heading (XWiki automatically generates anchor IDs like {{code}}HHeadingName{{/code}} for each heading).
422 -
423 -== Mention Macro {{id name="mention-macro" /}}==
424 -
425 -The **Mention** macro allows you to mention a user in content, similar to an @-mention on social platforms. It will typically display the user’s name and trigger a notification to that user.
426 -
427 -**Example:** Mentioning a user
428 -
429 -@John Doe
430 -**Source:**
431 -
432 -
433 -{{code}}
247 +{{example}}
434 434  {{mention user="xwiki:JohnDoe"/}}
435 -{{/code}}
249 +{{/example}}
436 436  
437 -In the example, {{code}}{{mention user="xwiki:JohnDoe"/}}{{/code}} would produce an @-mention for the user with the username //JohnDoe// (on the //xwiki// wiki). The exact syntax for the user reference may include the wiki and space depending on your configuration. When rendered, it shows the user's name (or profile link), and the user would get a notification that they were mentioned.
251 +== Notifications Macro ==
438 438  
439 -== Notifications Macro {{id name="notifications-macro" /}}==
253 +The **Notifications** macro displays recent activity.
440 440  
441 -The **Notifications** macro displays a feed of recent events (like edits, comments, etc.) on the wiki​:contentReference[oaicite:32]{index=32}. This is usually what you see in the "Activity" or "Notifications" panel on the dashboard. It respects the current user's notification preferences and permissions.
442 -
443 -**Example:** Showing recent wiki notifications
444 -
445 -**Source:**
446 -
447 -
448 -{{code}}
255 +{{example}}
449 449  {{notifications/}}
450 -{{/code}}
257 +{{/example}}
451 451  
452 -Using {{code}}{{notifications/}}{{/code}} will embed a live notifications feed. Users will see a list of recent events with options to filter or mark as read, similar to the main Notifications panel.
259 +== Office Macro ==
453 453  
454 -== Office Macro {{id name="office-macro" /}}==
261 +The **Office** macro displays Office documents.
455 455  
456 -The **Office** macro displays an office document (such as a Word, Excel, or PowerPoint file) directly within a wiki page​:contentReference[oaicite:33]{index=33}. The document must be attached to the wiki (or accessible via a reference). The macro will render the content (for example, using an Office viewer or PDF conversion) so users can read it without downloading.
457 -
458 -**Example:** Embedding an attached Word document
459 -
460 -**Source:**
461 -
462 -
463 -{{code}}
263 +{{example}}
464 464  {{office attachment="Main.UserGuide@Guide.docx"/}}
465 -{{/code}}
265 +{{/example}}
466 466  
467 -This will display the //Guide.docx// file attached to the //Main.UserGuide// page. The content of the document will be shown (users can scroll through the pages of the document on the wiki page). Supported file formats include Word documents (.doc/.docx), Excel spreadsheets, PowerPoint presentations, OpenOffice/LibreOffice formats (odt, ods, odp), etc.​:contentReference[oaicite:34]{index=34}.
267 +== Python Macro ==
468 468  
469 -== Python Macro {{id name="python-macro" /}}==
269 +The **Python** macro executes Python scripts.
470 470  
471 -The **Python** macro executes a Python script on the server side​:contentReference[oaicite:35]{index=35}. This requires a Python scripting engine to be installed (such as Jython). Like the Groovy macro, it needs programming rights and can interact with the XWiki API.
271 +{{example}}
272 +{{python}}
273 +print("Hello from Python!")
274 +{{/python}}
275 +{{/example}}
472 472  
473 -**Example:** A simple Python script
277 +== Script Macro ==
474 474  
475 -{{code}}Hello from Python!{{/code}}
476 -**Source:**
279 +The **Script** macro executes scripts in different languages.
477 477  
281 +{{example}}
282 +{{script language="velocity"}}
283 +#set($name = "Velocity")
284 +Hello $name!
285 +{{/script}}
286 +{{/example}}
478 478  
479 -{{code}}
480 -{{python}} print("Hello from Python!") {{/python}}
481 -{{/code}}
288 +== Tag Cloud Macro ==
482 482  
483 -If the Python macro is enabled and a Python engine is available, the above would output “Hello from Python!”. You can use the XWiki Python API (similar to the Groovy example) to work with the wiki's content within the script.
290 +The **Tag Cloud** macro displays tags visually.
484 484  
485 -== Script Macro {{id name="script-macro" /}}==
486 -
487 -The **Script** macro executes a script in a specified scripting language​:contentReference[oaicite:36]{index=36}. It is a generic container for different script types (Velocity, Groovy, Python, etc.) controlled by the {{code}}language{{/code}} parameter.
488 -
489 -**Example:** Using the Script macro for a Velocity script
490 -
491 -{{code}}Hello Velocity!{{/code}}
492 -**Source:**
493 -
494 -
495 -{{code}}
496 -{{script language="velocity"}} #set($name = "Velocity") Hello $name! {{/script}}
497 -{{/code}}
498 -
499 -This does the same as writing a Velocity macro block. The Script macro is handy when you want to dynamically choose the language or when including code from an external source using its {{code}}source{{/code}} parameter (for instance, {{code}}{{script language="groovy" source="document:Space.Page"/}}{{/code}} to run a Groovy script from another page). In most cases, using the dedicated language macro (like {{code}}{{velocity}}{{/code}} or {{code}}{{groovy}}{{/code}}) is simpler.
500 -
501 -== Tag Cloud Macro {{id name="tag-cloud-macro" /}}==
502 -
503 -The **Tag Cloud** macro shows a cloud of tags, where the size of each tag indicates its frequency in the wiki (or in a specific space)​:contentReference[oaicite:37]{index=37}. This provides a visual overview of popular tags.
504 -
505 -**Example:** Tag cloud for the whole wiki
506 -
507 -tag1 tag2 tag3 ...
508 -**Source:**
509 -
510 -
511 -{{code}}
292 +{{example}}
512 512  {{tagcloud/}}
513 -{{/code}}
294 +{{/example}}
514 514  
515 -This will display a tag cloud of all tags in the wiki. To limit to a specific space, use the {{code}}space{{/code}} parameter. For example, {{code}}{{tagcloud space="Blog"/}}{{/code}} would show tags just from pages in the Blog space.
296 +== User Avatar Macro ==
516 516  
517 -== Table of Contents (TOC) Macro {{id name="table-of-contents-toc-macro" /}}==
298 +The **User Avatar** macro shows a user's avatar image.
518 518  
519 -The **TOC** macro generates a table of contents for the headings in the page​:contentReference[oaicite:38]{index=38}. It is often used at the top of a page to list its sections. You can customize it with parameters like {{code}}start{{/code}} level, {{code}}depth{{/code}}, and whether to number the headings.
300 +{{example}}
301 +{{useravatar user="xwiki:JohnDoe"/}}
302 +{{/example}}
520 520  
521 -**Example:** Basic TOC
304 +== Velocity Macro ==
522 522  
523 -*. Introduction
524 -*. Details
525 -**. Subsection
526 -*. Conclusion
306 +The **Velocity** macro executes Velocity scripts.
527 527  
528 -**Source:**
308 +{{example}}
309 +{{velocity}}
310 +#set($name = "Alice")
311 +Hello $name!
312 +{{/velocity}}
313 +{{/example}}
529 529  
315 +== Menu Macro ==
530 530  
531 -{{code}}
532 -{{toc/}}
533 -{{/code}}
317 +The **Menu** macro builds a navigation menu.
534 534  
535 -This will insert a table of contents listing all headings in the page.
319 +{{example}}
320 +{{menu}}
321 +* [[Home>>Main.WebHome]]
322 +* [[Products>>Main.Products]]
323 +** [[Product A>>Main.Products.ProductA]]
324 +** [[Product B>>Main.Products.ProductB]]
325 +* [[Contact>>Main.Contact]]
326 +{{/menu}}
327 +{{/example}}
536 536  
537 -**Example:** TOC starting from level 2 headings
538 538  
539 -**Source:**
540 -
541 -
542 -{{code}}
543 -{{toc start="2" numbered="true"/}}
544 -{{/code}}
545 -
546 -In this second example, the TOC will skip level 1 headings and start at level 2, and the entries will be numbered. For instance, a level 2 heading will be labeled “1.”, its level 3 subheading “1.1”, and so on.
547 -
548 -== User Avatar Macro {{id name="user-avatar-macro" /}}==
549 -
550 -The **UserAvatar** macro displays the avatar image of a specified user​:contentReference[oaicite:39]{index=39}. You can use this to show user pictures in pages (for example, in comments or user listings).
551 -
552 -**Example:** Showing a user's avatar
553 -
554 -[[image:https://www.xwiki.org/xwiki/bin/download/Static/Icons/user.png||alt="Avatar"]] John Doe
555 -**Source:**
556 -
557 -
558 -{{code}}
559 -{{useravatar user="xwiki:JohnDoe"/}} John Doe
560 -{{/code}}
561 -
562 -In this example, {{code}}{{useravatar user="xwiki:JohnDoe"/}}{{/code}} would display the profile avatar of the user //JohnDoe// (with a default icon if the user hasn’t set one). You can adjust the size via parameters if needed (e.g., {{code}}size="large"{{/code}} for a larger avatar), depending on the macro's implementation.
563 -
564 -== Velocity Macro {{id name="velocity-macro" /}}==
565 -
566 -The **Velocity** macro executes a Velocity script on the server side​:contentReference[oaicite:40]{index=40}. Velocity is the default scripting language for XWiki and can be used without explicitly using this macro (since wiki pages themselves can contain Velocity code enclosed in {{code}}{{velocity}}{{/code}}... by default if allowed). However, using the macro explicitly can control scope and avoid interference with other syntax.
567 -
568 -**Example:** A simple Velocity script
569 -
570 -{{code}}Hello Alice!{{/code}}
571 -**Source:**
572 -
573 -
574 -{{code}}
575 -{{velocity}} #set($name = "Alice") Hello $name! {{/velocity}}
576 -{{/code}}
577 -
578 -This will output “Hello Alice!”. In Velocity, variables are defined with {{code}}#set{{/code}} and referenced with {{code}}${{/code}}. Velocity has access to many predefined variables (like {{code}}$doc{{/code}} for the current document, {{code}}$services{{/code}}, etc.) in XWiki’s context.
579 -
580 -== Menu Macro {{id name="menu-macro" /}}==
581 -
582 -The **Menu** macro can generate a navigation menu from a nested list of links. You provide the menu structure in wiki syntax (using nested bullet points) inside the macro, and it will render it as a styled menu.
583 -
584 -**Example:** Simple menu
585 -
586 -*. [[Home>>#]]
587 -*. [[Products>>#]]
588 -**. [[Product A>>#]]
589 -**. [[Product B>>#]]
590 -*. [[Contact>>#]]
591 -
592 -**Source:**
593 -
594 -
595 -{{code}}
596 -{{menu}} * [[Home>>Main.WebHome]] * [[Products>>Main.Products]] ** [[Product A>>Main.Products.ProductA]] ** [[Product B>>Main.Products.ProductB]] * [[Contact>>Main.Contact]] {{/menu}}
597 -{{/code}}