0 Votes

Changes for page MyWiki

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

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

Summary

Details

Page properties
Content
... ... @@ -1,498 +1,597 @@
1 -= XWiki Macros Reference Guide =
1 += XWiki Macros Reference Guide {{id name="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" /}}==
5 5  
6 -== TOC Macro ==
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.
7 7  
8 -The **TOC** macro generates a Table of Contents.
9 +**Example:** A simple box with a custom title
9 9  
10 -{{example}}
11 -{{toc/}}
12 -{{/example}}
11 +**Note:** This is a sample box message.
12 +**Source:**
13 13  
14 -== Box Macro ==
15 15  
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.
15 +{{code}}
16 +{{box title="Note"}} This is a sample box message. {{/box}}
17 +{{/code}}
17 17  
18 -{{example}}
19 -{{box title="Note"}}
20 -This is a sample box message.
21 -{{/box}}
22 -{{/example}}
19 +== Info Macro {{id name="info-macro" /}}==
23 23  
24 -== Info Macro ==
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}}).
25 25  
26 -The **Info** macro displays an informational message in a styled box. It is typically rendered with a blue color to denote general information.
23 +**Example:** An info message box
27 27  
28 -{{example}}
29 -{{info}}
30 30  This is an informational message.
31 -{{/info}}
32 -{{/example}}
26 +**Source:**
33 33  
34 -{{example}}
35 -{{info title="FYI"}}
36 -This is an informational message with a title.
37 -{{/info}}
38 -{{/example}}
39 39  
40 -== Warning Macro ==
29 +{{code}}
30 +{{info}}This is an informational message{{/info}}
31 +{{/code}}
41 41  
42 -The **Warning** macro highlights a warning message in a styled box (yellow/orange background).
33 +**Example (with title):** An info message with a title
43 43  
44 -{{example}}
45 -{{warning}}
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 +
46 46  This is a warning message.
47 -{{/warning}}
48 -{{/example}}
50 +**Source:**
49 49  
50 -== Success Macro ==
51 51  
52 -The **Success** macro displays a success message in a green-styled box.
53 +{{code}}
54 +{{warning}}This is a warning message{{/warning}}
55 +{{/code}}
53 53  
54 -{{example}}
55 -{{success}}
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 +
56 56  This is a success message.
57 -{{/success}}
58 -{{/example}}
64 +**Source:**
59 59  
60 -== Error Macro ==
61 61  
62 -The **Error** macro displays a critical error or alert message in a red-styled box.
67 +{{code}}
68 +{{success}}This is a success message{{/success}}
69 +{{/code}}
63 63  
64 -{{example}}
65 -{{error}}
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 +
66 66  This is an error message.
67 -{{/error}}
68 -{{/example}}
78 +**Source:**
69 69  
70 -== Chart Macro ==
71 71  
72 -The **Chart** macro generates graphical charts based on input tables.
81 +{{code}}
82 +{{error}}This is an error message{{/error}}
83 +{{/code}}
73 73  
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}}
85 +== Chart Macro {{id name="chart-macro" /}}==
82 82  
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}}
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).
91 91  
92 -== Children Macro ==
89 +**Example:** An inline pie chart
93 93  
94 -The **Children** macro lists the child pages of the current page.
91 +(This chart would show the distribution of three categories A, B, and C in a pie chart.)
95 95  
96 -{{example}}
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}}
97 97  {{children/}}
98 -{{/example}}
129 +{{/code}}
99 99  
100 -== Code Macro ==
131 +In this example, {{code}}{{children/}}{{/code}} would produce a bulleted list of links to all pages that are children of the current page.
101 101  
102 -The **Code** macro highlights and formats source code.
133 +== Code Macro {{id name="code-macro" /}}==
103 103  
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 -}
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"); } }
111 111  {{/code}}
112 -{{/example}}
113 113  
114 -== Comment Macro ==
144 +**Source:**
115 115  
116 -The **Comment** macro hides content from page rendering.
117 117  
118 -{{example}}
119 -Visible part 1.
120 -{{comment}}This text will not be visible.{{/comment}}
121 -Visible part 2.
122 -{{/example}}
147 +{{code}}
148 +{{code language="java"}} public class Hello { public static void main(String[] args) { System.out.println("Hello World"); } } {{/code}}
149 +{{/code}}
123 123  
124 -== Container Macro ==
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:
125 125  
126 -The **Container** macro creates multi-column layouts.
127 127  
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}}
154 +{{code}}
155 +{{code language="java" layout="linenumbers"}} ... code ... {{/code}}
156 +{{/code}}
134 134  
135 -== Dashboard Macro ==
158 +== Comment Macro {{id name="comment-macro" /}}==
136 136  
137 -The **Dashboard** macro creates areas for gadgets.
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.
138 138  
139 -{{example}}
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}}
140 140  {{dashboard columns="2"/}}
141 -{{/example}}
205 +{{/code}}
142 142  
143 -== Display Macro ==
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.
144 144  
145 -The **Display** macro embeds content from another page.
209 +== Display Macro {{id name="display-macro" /}}==
146 146  
147 -{{example}}
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}}
148 148  {{display page="Help.Macros"/}}
149 -{{/example}}
220 +{{/code}}
150 150  
151 -== DisplayIcon Macro ==
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.
152 152  
153 -The **DisplayIcon** macro displays an icon.
224 +== DisplayIcon Macro {{id name="displayicon-macro" /}}==
154 154  
155 -{{example}}
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}}
156 156  {{displayIcon name="home"/}} Home
157 -{{/example}}
236 +{{/code}}
158 158  
159 -== Documents Macro ==
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.).
160 160  
161 -The **Documents** macro shows a livetable of documents.
240 +== Documents Macro {{id name="documents-macro" /}}==
162 162  
163 -{{example}}
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}}
164 164  {{documents space="MySpace"/}}
165 -{{/example}}
255 +{{/code}}
166 166  
167 -== DocumentTree Macro ==
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).
168 168  
169 -The **DocumentTree** macro shows a collapsible page tree.
259 +== DocumentTree Macro {{id name="documenttree-macro" /}}==
170 170  
171 -{{example}}
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}}
172 172  {{documentTree reference="Help.WebHome"/}}
173 -{{/example}}
276 +{{/code}}
174 174  
175 -== Footnote Macro ==
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.
176 176  
177 -The **Footnote** macro adds footnotes to the page.
280 +== Footnote Macro {{id name="footnote-macro" /}}==
178 178  
179 -{{example}}
180 -This is a statement{{footnote}}Source: Example Reference{{/footnote}}.
181 -{{putFootnotes/}}
182 -{{/example}}
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.
183 183  
184 -== PutFootnotes Macro ==
284 +**Example:** Adding a footnote to a sentence
185 185  
186 -The **PutFootnotes** macro outputs collected footnotes.
286 +This is a statement^^[1]^^ with a reference.\\[1] Source: Example Reference
287 +**Source:**
187 187  
188 -{{example}}
189 -...page content...
190 -{{putFootnotes/}}
191 -{{/example}}
192 192  
193 -== Gallery Macro ==
290 +{{code}}
291 +This is a statement{{footnote}}Source: Example Reference{{/footnote}} with a reference. {{putFootnotes/}}
292 +{{/code}}
194 194  
195 -The **Gallery** macro displays a collection of images.
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}.
196 196  
197 -{{example}}
198 -{{gallery}}
199 -image:Space.Page@Image1.png
200 -image:Space.Page@Image2.png
201 -{{/gallery}}
202 -{{/example}}
296 +== PutFootnotes Macro {{id name="putfootnotes-macro" /}}==
203 203  
204 -== Groovy Macro ==
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.
205 205  
206 -The **Groovy** macro executes Groovy scripts.
300 +**Example:** Placing footnotes at a custom location
207 207  
208 -{{example}}
209 -{{groovy}}
210 -println("Hello from Groovy!")
211 -{{/groovy}}
212 -{{/example}}
302 +**Source:**
213 213  
214 -== HTML Macro ==
215 215  
216 -The **HTML** macro embeds raw HTML into pages.
305 +{{code}}
306 +... page content ... {{putFootnotes/}}
307 +{{/code}}
217 217  
218 -{{example}}
219 -{{html}}
220 -<p style="color:red;">This is red text via HTML.</p>
221 -{{/html}}
222 -{{/example}}
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.
223 223  
224 -== Id Macro ==
311 +== Gallery Macro {{id name="gallery-macro" /}}==
225 225  
226 -The **Id** macro defines an internal link anchor.
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.
227 227  
228 -{{example}}
229 -Click [[here>>#myanchor]] to jump.
315 +**Example:** A simple image gallery
230 230  
231 -{{id name="myanchor"/}}
232 -**Target Location:** You have reached the target.
233 -{{/example}}
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)
234 234  
235 -== Include Macro ==
320 +**Source:**
236 236  
237 -The **Include** macro includes another page's content.
238 238  
239 -{{example}}
240 -{{include page="Help.Introduction"/}}
241 -{{/example}}
323 +{{code}}
324 +{{gallery}} image:Space.Page@Image1.png image:Space.Page@Image2.png {{/gallery}}
325 +{{/code}}
242 242  
243 -== Mention Macro ==
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}}).
244 244  
245 -The **Mention** macro notifies a mentioned user.
329 +== Groovy Macro {{id name="groovy-macro" /}}==
246 246  
247 -{{example}}
248 -{{mention user="xwiki:JohnDoe"/}}
249 -{{/example}}
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.
250 250  
251 -== Notifications Macro ==
333 +**Example:** A simple Groovy script printing a message
252 252  
253 -The **Notifications** macro displays recent activity.
335 +{{code}}Hello from Groovy!{{/code}}
336 +**Source:**
254 254  
255 -{{example}}
256 -{{notifications/}}
257 -{{/example}}
258 258  
259 -== Office Macro ==
339 +{{code}}
340 +{{groovy}} println("Hello from Groovy!"); {{/groovy}}
341 +{{/code}}
260 260  
261 -The **Office** macro displays Office documents.
343 +**Example:** Using Groovy to access XWiki API
262 262  
263 -{{example}}
264 -{{office attachment="Main.UserGuide@Guide.docx"/}}
265 -{{/example}}
345 +{{code}}This page is: {{/code}}//{{code}}Sample.Page{{/code}}//
346 +**Source:**
266 266  
267 -== Python Macro ==
268 268  
269 -The **Python** macro executes Python scripts.
349 +{{code}}
350 +{{groovy}} def doc = xcontext.getDoc(); println("This page is: " + doc.getFullName()); {{/groovy}}
351 +{{/code}}
270 270  
271 -{{example}}
272 -{{python}}
273 -print("Hello from Python!")
274 -{{/python}}
275 -{{/example}}
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.
276 276  
277 -== Script Macro ==
355 +== HTML Macro {{id name="html-macro" /}}==
278 278  
279 -The **Script** macro executes scripts in different languages.
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 doesnt support. (Using this macro may require programming rights to avoid security risks such as XSS.)
280 280  
281 -{{example}}
282 -{{script language="velocity"}}
283 -#set($name = "Velocity")
284 -Hello $name!
285 -{{/script}}
286 -{{/example}}
359 +**Example:** Inserting a custom HTML snippet
287 287  
288 -== Tag Cloud Macro ==
361 +This is red text via HTML.
362 +**Source:**
289 289  
290 -The **Tag Cloud** macro displays tags visually.
291 291  
292 -{{example}}
293 -{{tagcloud/}}
294 -{{/example}}
365 +{{code}}
366 +{{html}} This is red text via HTML. {{/html}}
367 +{{/code}}
295 295  
296 -== User Avatar Macro ==
369 +**Example:** Embedding an iframe (e.g., a YouTube video)
297 297  
298 -The **User Avatar** macro shows a user's avatar image.
299 299  
300 -{{example}}
301 -{{useravatar user="xwiki:JohnDoe"/}}
302 -{{/example}}
372 +**Source:**
303 303  
304 -== Velocity Macro ==
305 305  
306 -The **Velocity** macro executes Velocity scripts.
375 +{{code}}
376 +{{html}} {{/html}}
377 +{{/code}}
307 307  
308 -{{example}}
309 -{{velocity}}
310 -#set($name = "Alice")
311 -Hello $name!
312 -{{/velocity}}
313 -{{/example}}
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.
314 314  
315 -== Menu Macro ==
381 +== Id Macro {{id name="id-macro" /}}==
316 316  
317 -The **Menu** macro builds a navigation menu.
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).
318 318  
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}}
385 +**Example:** Creating and linking to an anchor
328 328  
329 -== Button Macro ==
387 +Click [[here>>#myanchor]] to jump. ...\\{{id name="myanchor" /}}**Target Location:** You have reached the target.
388 +**Source:**
330 330  
331 -The Button macro inserts a styled clickable button.
332 332  
333 -{{example}}
334 -{{button link="https://xwiki.org" style="primary"}}
335 -Click Me
336 -{{/button}}
337 -{{/example}}
391 +{{code}}
392 +Click [[here>>#myanchor]] to jump. ... {{id name="myanchor"/}}**Target Location:** You have reached the target.
393 +{{/code}}
338 338  
339 -== Carousel Macro ==
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.
340 340  
341 -The Carousel macro displays a slideshow of images.
397 +== Include Macro {{id name="include-macro" /}}==
342 342  
343 -{{example}}
344 -{{carousel}}
345 -image:Space.Page@Image1.png
346 -image:Space.Page@Image2.png
347 -{{/carousel}}
348 -{{/example}}
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}.
349 349  
350 -== Embed Macro ==
401 +**Example:** Including a page
351 351  
352 -The Embed macro shows external content like YouTube videos.
403 +**Source:**
353 353  
354 -{{example}}
355 -{{embed url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/}}
356 -{{/example}}
357 357  
358 -== Expandable Macro ==
406 +{{code}}
407 +{{include page="Help.Introduction"/}}
408 +{{/code}}
359 359  
360 -The Expandable macro shows expandable hidden content.
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.
361 361  
362 -{{example}}
363 -{{expandable title="Click to Expand"}}
364 -Hidden details appear here.
365 -{{/expandable}}
366 -{{/example}}
412 +**Example:** Including a specific section of a page
367 367  
368 -== Excerpt Macro ==
414 +**Source:**
369 369  
370 -The Excerpt macro marks content for reuse elsewhere.
371 371  
372 -{{example}}
373 -{{excerpt}}
374 -This is excerpted content.
375 -{{/excerpt}}
376 -{{/example}}
417 +{{code}}
418 +{{include page="Help.Macros" section="HExamples"/}}
419 +{{/code}}
377 377  
378 -== FAQ Macro ==
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).
379 379  
380 -The FAQ macro lists FAQ entries.
423 +== Mention Macro {{id name="mention-macro" /}}==
381 381  
382 -{{example}}
383 -{{faq space="FAQ"/}}
384 -{{/example}}
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.
385 385  
386 -== Live Data Macro ==
427 +**Example:** Mentioning a user
387 387  
388 -The LiveData macro displays dynamic data tables.
429 +@John Doe
430 +**Source:**
389 389  
390 -{{example}}
391 -{{liveData source="document"/}}
392 -{{/example}}
393 393  
394 -== Panel Macro ==
433 +{{code}}
434 +{{mention user="xwiki:JohnDoe"/}}
435 +{{/code}}
395 395  
396 -The Panel macro creates styled content boxes.
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.
397 397  
398 -{{example}}
399 -{{panel title="Panel Title"}}
400 -This is inside a panel.
401 -{{/panel}}
402 -{{/example}}
439 +== Notifications Macro {{id name="notifications-macro" /}}==
403 403  
404 -== PDF Viewer Macro ==
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.
405 405  
406 -The PDFViewer macro embeds PDFs using PDF.js.
443 +**Example:** Showing recent wiki notifications
407 407  
408 -{{example}}
409 -{{pdfviewer attachment="MyPage@file.pdf"/}}
410 -{{/example}}
445 +**Source:**
411 411  
412 -== Profile Picture Macro ==
413 413  
414 -The Profile Picture macro shows a user’s picture.
448 +{{code}}
449 +{{notifications/}}
450 +{{/code}}
415 415  
416 -{{example}}
417 -{{profile-picture user="xwiki:JohnDoe"/}}
418 -{{/example}}
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.
419 419  
420 -== Recently Updated Macro ==
454 +== Office Macro {{id name="office-macro" /}}==
421 421  
422 -The Recently Updated macro lists recent changes.
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.
423 423  
424 -{{example}}
425 -{{recently-updated/}}
426 -{{/example}}
458 +**Example:** Embedding an attached Word document
427 427  
428 -== Status Macro ==
460 +**Source:**
429 429  
430 -The Status macro adds a colored status label.
431 431  
432 -{{example}}
433 -{{status value="In Progress" color="yellow"/}}
434 -{{/example}}
463 +{{code}}
464 +{{office attachment="Main.UserGuide@Guide.docx"/}}
465 +{{/code}}
435 435  
436 -== Team Macro ==
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}.
437 437  
438 -The Team macro shows avatars of a team.
469 +== Python Macro {{id name="python-macro" /}}==
439 439  
440 -{{example}}
441 -{{team space="TeamSpace"/}}
442 -{{/example}}
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.
443 443  
444 -== Tooltip Macro ==
473 +**Example:** A simple Python script
445 445  
446 -The Tooltip macro shows hints on hover.
475 +{{code}}Hello from Python!{{/code}}
476 +**Source:**
447 447  
448 -{{example}}
449 -Hover {{tooltip content="Extra Information"}}here{{/tooltip}}.
450 -{{/example}}
451 451  
452 -== Tree Macro ==
479 +{{code}}
480 +{{python}} print("Hello from Python!") {{/python}}
481 +{{/code}}
453 453  
454 -The Tree macro shows a hierarchical list.
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.
455 455  
456 -{{example}}
457 -{{tree}}
485 +== Script Macro {{id name="script-macro" /}}==
458 458  
459 -[[Parent>>Parent.Page]]
460 -** [[Child 1>>Parent.Child1]]
461 -** [[Child 2>>Parent.Child2]]
462 -{{/tree}}
463 -{{/example}}
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.
464 464  
465 -== Video Macro ==
489 +**Example:** Using the Script macro for a Velocity script
466 466  
467 -The Video macro embeds videos.
491 +{{code}}Hello Velocity!{{/code}}
492 +**Source:**
468 468  
469 -{{example}}
470 -{{video url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/}}
471 -{{/example}}
472 472  
473 -== View File Macro ==
495 +{{code}}
496 +{{script language="velocity"}} #set($name = "Velocity") Hello $name! {{/script}}
497 +{{/code}}
474 474  
475 -The View File macro shows a file viewer.
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.
476 476  
477 -{{example}}
478 -{{view-file reference="Space.Page@file.pdf"/}}
479 -{{/example}}
501 +== Tag Cloud Macro {{id name="tag-cloud-macro" /}}==
480 480  
481 -== UI Extension Macro ==
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.
482 482  
483 -The UIExtension macro injects UI elements.
505 +**Example:** Tag cloud for the whole wiki
484 484  
485 -{{example}}
486 -{{uiextension extensionPointId="org.xwiki.platform.template.header.after"/}}
487 -{{/example}}
507 +tag1 tag2 tag3 ...
508 +**Source:**
488 488  
489 -== UI Extensions Macro ==
490 490  
491 -The UIExtensions macro lists UI extensions.
511 +{{code}}
512 +{{tagcloud/}}
513 +{{/code}}
492 492  
493 -{{example}}
494 -{{uiextensions/}}
495 -{{/example}}
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.
496 496  
517 +== Table of Contents (TOC) Macro {{id name="table-of-contents-toc-macro" /}}==
497 497  
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.
498 498  
521 +**Example:** Basic TOC
522 +
523 +*. Introduction
524 +*. Details
525 +**. Subsection
526 +*. Conclusion
527 +
528 +**Source:**
529 +
530 +
531 +{{code}}
532 +{{toc/}}
533 +{{/code}}
534 +
535 +This will insert a table of contents listing all headings in the page.
536 +
537 +**Example:** TOC starting from level 2 headings
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}}

XWiki AI Chat