0 Votes

Wiki source code of MyWiki

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

Hide last authors
Ryan C 10.1 1 = XWiki Macros Reference Guide =
Ryan C 9.1 2
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
5
Ryan C 10.1 6 == TOC Macro ==
Ryan C 9.1 7
Ryan C 10.1 8 The **TOC** macro generates a Table of Contents.
Ryan C 9.1 9
Ryan C 10.1 10 {{example}}
11 {{toc/}}
12 {{/example}}
Ryan C 9.1 13
Ryan C 10.1 14 == Box Macro ==
Ryan C 9.1 15
Ryan C 10.1 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.
Ryan C 9.1 17
Ryan C 10.1 18 {{example}}
19 {{box title="Note"}}
20 This is a sample box message.
21 {{/box}}
22 {{/example}}
Ryan C 9.1 23
Ryan C 10.1 24 == Info Macro ==
Ryan C 9.1 25
Ryan C 10.1 26 The **Info** macro displays an informational message in a styled box. It is typically rendered with a blue color to denote general information.
Ryan C 9.1 27
Ryan C 10.1 28 {{example}}
29 {{info}}
Ryan C 9.1 30 This is an informational message.
Ryan C 10.1 31 {{/info}}
32 {{/example}}
Ryan C 9.1 33
Ryan C 10.1 34 {{example}}
35 {{info title="FYI"}}
36 This is an informational message with a title.
37 {{/info}}
38 {{/example}}
Ryan C 9.1 39
Ryan C 10.1 40 == Warning Macro ==
Ryan C 9.1 41
Ryan C 10.1 42 The **Warning** macro highlights a warning message in a styled box (yellow/orange background).
Ryan C 9.1 43
Ryan C 10.1 44 {{example}}
45 {{warning}}
Ryan C 9.1 46 This is a warning message.
Ryan C 10.1 47 {{/warning}}
48 {{/example}}
Ryan C 9.1 49
Ryan C 10.1 50 == Success Macro ==
Ryan C 9.1 51
Ryan C 10.1 52 The **Success** macro displays a success message in a green-styled box.
Ryan C 9.1 53
Ryan C 10.1 54 {{example}}
55 {{success}}
Ryan C 9.1 56 This is a success message.
Ryan C 10.1 57 {{/success}}
58 {{/example}}
Ryan C 9.1 59
Ryan C 10.1 60 == Error Macro ==
Ryan C 9.1 61
Ryan C 10.1 62 The **Error** macro displays a critical error or alert message in a red-styled box.
Ryan C 9.1 63
Ryan C 10.1 64 {{example}}
65 {{error}}
Ryan C 9.1 66 This is an error message.
Ryan C 10.1 67 {{/error}}
68 {{/example}}
Ryan C 9.1 69
Ryan C 10.1 70 == Chart Macro ==
Ryan C 9.1 71
Ryan C 10.1 72 The **Chart** macro generates graphical charts based on input tables.
Ryan C 9.1 73
Ryan C 10.1 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}}
Ryan C 9.1 82
Ryan C 10.1 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}}
Ryan C 9.1 91
Ryan C 10.1 92 == Children Macro ==
Ryan C 9.1 93
Ryan C 10.1 94 The **Children** macro lists the child pages of the current page.
Ryan C 9.1 95
Ryan C 10.1 96 {{example}}
Ryan C 9.1 97 {{children/}}
Ryan C 10.1 98 {{/example}}
Ryan C 9.1 99
Ryan C 10.1 100 == Code Macro ==
Ryan C 9.1 101
Ryan C 10.1 102 The **Code** macro highlights and formats source code.
Ryan C 9.1 103
Ryan C 10.1 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 }
Ryan C 9.1 111 {{/code}}
Ryan C 10.1 112 {{/example}}
Ryan C 9.1 113
Ryan C 10.1 114 == Comment Macro ==
Ryan C 9.1 115
Ryan C 10.1 116 The **Comment** macro hides content from page rendering.
Ryan C 9.1 117
Ryan C 10.1 118 {{example}}
119 Visible part 1.
120 {{comment}}This text will not be visible.{{/comment}}
121 Visible part 2.
122 {{/example}}
Ryan C 9.1 123
Ryan C 10.1 124 == Container Macro ==
Ryan C 9.1 125
Ryan C 10.1 126 The **Container** macro creates multi-column layouts.
Ryan C 9.1 127
Ryan C 10.1 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}}
Ryan C 9.1 134
Ryan C 10.1 135 == Dashboard Macro ==
Ryan C 9.1 136
Ryan C 10.1 137 The **Dashboard** macro creates areas for gadgets.
Ryan C 9.1 138
Ryan C 10.1 139 {{example}}
Ryan C 9.1 140 {{dashboard columns="2"/}}
Ryan C 10.1 141 {{/example}}
Ryan C 9.1 142
Ryan C 10.1 143 == Display Macro ==
Ryan C 9.1 144
Ryan C 10.1 145 The **Display** macro embeds content from another page.
Ryan C 9.1 146
Ryan C 10.1 147 {{example}}
Ryan C 9.1 148 {{display page="Help.Macros"/}}
Ryan C 10.1 149 {{/example}}
Ryan C 9.1 150
Ryan C 10.1 151 == DisplayIcon Macro ==
Ryan C 9.1 152
Ryan C 10.1 153 The **DisplayIcon** macro displays an icon.
Ryan C 9.1 154
Ryan C 10.1 155 {{example}}
Ryan C 9.1 156 {{displayIcon name="home"/}} Home
Ryan C 10.1 157 {{/example}}
Ryan C 9.1 158
Ryan C 10.1 159 == Documents Macro ==
Ryan C 9.1 160
Ryan C 10.1 161 The **Documents** macro shows a livetable of documents.
Ryan C 9.1 162
Ryan C 10.1 163 {{example}}
Ryan C 9.1 164 {{documents space="MySpace"/}}
Ryan C 10.1 165 {{/example}}
Ryan C 9.1 166
Ryan C 10.1 167 == DocumentTree Macro ==
Ryan C 9.1 168
Ryan C 10.1 169 The **DocumentTree** macro shows a collapsible page tree.
Ryan C 9.1 170
Ryan C 10.1 171 {{example}}
Ryan C 9.1 172 {{documentTree reference="Help.WebHome"/}}
Ryan C 10.1 173 {{/example}}
Ryan C 9.1 174
Ryan C 10.1 175 == Footnote Macro ==
Ryan C 9.1 176
Ryan C 10.1 177 The **Footnote** macro adds footnotes to the page.
Ryan C 9.1 178
Ryan C 10.1 179 {{example}}
180 This is a statement{{footnote}}Source: Example Reference{{/footnote}}.
181 {{putFootnotes/}}
182 {{/example}}
Ryan C 9.1 183
Ryan C 10.1 184 == PutFootnotes Macro ==
Ryan C 9.1 185
Ryan C 10.1 186 The **PutFootnotes** macro outputs collected footnotes.
Ryan C 9.1 187
Ryan C 10.1 188 {{example}}
189 ...page content...
190 {{putFootnotes/}}
191 {{/example}}
Ryan C 9.1 192
Ryan C 10.1 193 == Gallery Macro ==
Ryan C 9.1 194
Ryan C 10.1 195 The **Gallery** macro displays a collection of images.
Ryan C 9.1 196
Ryan C 10.1 197 {{example}}
198 {{gallery}}
199 image:Space.Page@Image1.png
200 image:Space.Page@Image2.png
201 {{/gallery}}
202 {{/example}}
Ryan C 9.1 203
Ryan C 10.1 204 == Groovy Macro ==
Ryan C 9.1 205
Ryan C 10.1 206 The **Groovy** macro executes Groovy scripts.
Ryan C 9.1 207
Ryan C 10.1 208 {{example}}
209 {{groovy}}
210 println("Hello from Groovy!")
211 {{/groovy}}
212 {{/example}}
Ryan C 9.1 213
Ryan C 10.1 214 == HTML Macro ==
Ryan C 9.1 215
Ryan C 10.1 216 The **HTML** macro embeds raw HTML into pages.
Ryan C 9.1 217
Ryan C 10.1 218 {{example}}
219 {{html}}
220 <p style="color:red;">This is red text via HTML.</p>
221 {{/html}}
222 {{/example}}
Ryan C 9.1 223
Ryan C 10.1 224 == Id Macro ==
Ryan C 9.1 225
Ryan C 10.1 226 The **Id** macro defines an internal link anchor.
Ryan C 9.1 227
Ryan C 10.1 228 {{example}}
229 Click [[here>>#myanchor]] to jump.
Ryan C 9.1 230
Ryan C 10.1 231 {{id name="myanchor"/}}
232 **Target Location:** You have reached the target.
233 {{/example}}
Ryan C 9.1 234
Ryan C 10.1 235 == Include Macro ==
Ryan C 9.1 236
Ryan C 10.1 237 The **Include** macro includes another page's content.
Ryan C 9.1 238
Ryan C 10.1 239 {{example}}
Ryan C 9.1 240 {{include page="Help.Introduction"/}}
Ryan C 10.1 241 {{/example}}
Ryan C 9.1 242
Ryan C 10.1 243 == Mention Macro ==
Ryan C 9.1 244
Ryan C 10.1 245 The **Mention** macro notifies a mentioned user.
Ryan C 9.1 246
Ryan C 10.1 247 {{example}}
Ryan C 9.1 248 {{mention user="xwiki:JohnDoe"/}}
Ryan C 10.1 249 {{/example}}
Ryan C 9.1 250
Ryan C 10.1 251 == Notifications Macro ==
Ryan C 9.1 252
Ryan C 10.1 253 The **Notifications** macro displays recent activity.
Ryan C 9.1 254
Ryan C 10.1 255 {{example}}
Ryan C 9.1 256 {{notifications/}}
Ryan C 10.1 257 {{/example}}
Ryan C 9.1 258
Ryan C 10.1 259 == Office Macro ==
Ryan C 9.1 260
Ryan C 10.1 261 The **Office** macro displays Office documents.
Ryan C 9.1 262
Ryan C 10.1 263 {{example}}
Ryan C 9.1 264 {{office attachment="Main.UserGuide@Guide.docx"/}}
Ryan C 10.1 265 {{/example}}
Ryan C 9.1 266
Ryan C 10.1 267 == Python Macro ==
Ryan C 9.1 268
Ryan C 10.1 269 The **Python** macro executes Python scripts.
Ryan C 9.1 270
Ryan C 10.1 271 {{example}}
272 {{python}}
273 print("Hello from Python!")
274 {{/python}}
275 {{/example}}
Ryan C 9.1 276
Ryan C 10.1 277 == Script Macro ==
Ryan C 9.1 278
Ryan C 10.1 279 The **Script** macro executes scripts in different languages.
Ryan C 9.1 280
Ryan C 10.1 281 {{example}}
282 {{script language="velocity"}}
283 #set($name = "Velocity")
284 Hello $name!
285 {{/script}}
286 {{/example}}
Ryan C 9.1 287
Ryan C 10.1 288 == Tag Cloud Macro ==
Ryan C 9.1 289
Ryan C 10.1 290 The **Tag Cloud** macro displays tags visually.
Ryan C 9.1 291
Ryan C 10.1 292 {{example}}
Ryan C 9.1 293 {{tagcloud/}}
Ryan C 10.1 294 {{/example}}
Ryan C 9.1 295
Ryan C 10.1 296 == User Avatar Macro ==
Ryan C 9.1 297
Ryan C 10.1 298 The **User Avatar** macro shows a user's avatar image.
Ryan C 9.1 299
Ryan C 10.1 300 {{example}}
301 {{useravatar user="xwiki:JohnDoe"/}}
302 {{/example}}
Ryan C 9.1 303
Ryan C 10.1 304 == Velocity Macro ==
Ryan C 9.1 305
Ryan C 10.1 306 The **Velocity** macro executes Velocity scripts.
Ryan C 9.1 307
Ryan C 10.1 308 {{example}}
309 {{velocity}}
310 #set($name = "Alice")
311 Hello $name!
312 {{/velocity}}
313 {{/example}}
Ryan C 9.1 314
Ryan C 10.1 315 == Menu Macro ==
Ryan C 9.1 316
Ryan C 10.1 317 The **Menu** macro builds a navigation menu.
Ryan C 9.1 318
Ryan C 10.1 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}}
Ryan C 9.1 328
Ryan C 11.1 329 == Button Macro ==
Ryan C 9.1 330
Ryan C 11.1 331 The Button macro inserts a styled clickable button.
332
333 {{example}}
334 {{button link="https://xwiki.org" style="primary"}}
335 Click Me
336 {{/button}}
337 {{/example}}
338
339 == Carousel Macro ==
340
341 The Carousel macro displays a slideshow of images.
342
343 {{example}}
344 {{carousel}}
345 image:Space.Page@Image1.png
346 image:Space.Page@Image2.png
347 {{/carousel}}
348 {{/example}}
349
350 == Embed Macro ==
351
352 The Embed macro shows external content like YouTube videos.
353
354 {{example}}
355 {{embed url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/}}
356 {{/example}}
357
358 == Expandable Macro ==
359
360 The Expandable macro shows expandable hidden content.
361
362 {{example}}
363 {{expandable title="Click to Expand"}}
364 Hidden details appear here.
365 {{/expandable}}
366 {{/example}}
367
368 == Excerpt Macro ==
369
370 The Excerpt macro marks content for reuse elsewhere.
371
372 {{example}}
373 {{excerpt}}
374 This is excerpted content.
375 {{/excerpt}}
376 {{/example}}
377
378 == FAQ Macro ==
379
380 The FAQ macro lists FAQ entries.
381
382 {{example}}
383 {{faq space="FAQ"/}}
384 {{/example}}
385
386 == Live Data Macro ==
387
388 The LiveData macro displays dynamic data tables.
389
390 {{example}}
391 {{liveData source="document"/}}
392 {{/example}}
393
394 == Panel Macro ==
395
396 The Panel macro creates styled content boxes.
397
398 {{example}}
399 {{panel title="Panel Title"}}
400 This is inside a panel.
401 {{/panel}}
402 {{/example}}
403
404 == PDF Viewer Macro ==
405
406 The PDFViewer macro embeds PDFs using PDF.js.
407
408 {{example}}
409 {{pdfviewer attachment="MyPage@file.pdf"/}}
410 {{/example}}
411
412 == Profile Picture Macro ==
413
414 The Profile Picture macro shows a user’s picture.
415
416 {{example}}
417 {{profile-picture user="xwiki:JohnDoe"/}}
418 {{/example}}
419
420 == Recently Updated Macro ==
421
422 The Recently Updated macro lists recent changes.
423
424 {{example}}
425 {{recently-updated/}}
426 {{/example}}
427
428 == Status Macro ==
429
430 The Status macro adds a colored status label.
431
432 {{example}}
433 {{status value="In Progress" color="yellow"/}}
434 {{/example}}
435
436 == Team Macro ==
437
438 The Team macro shows avatars of a team.
439
440 {{example}}
441 {{team space="TeamSpace"/}}
442 {{/example}}
443
444 == Tooltip Macro ==
445
446 The Tooltip macro shows hints on hover.
447
448 {{example}}
449 Hover {{tooltip content="Extra Information"}}here{{/tooltip}}.
450 {{/example}}
451
452 == Tree Macro ==
453
454 The Tree macro shows a hierarchical list.
455
456 {{example}}
457 {{tree}}
458
459 [[Parent>>Parent.Page]]
460 ** [[Child 1>>Parent.Child1]]
461 ** [[Child 2>>Parent.Child2]]
462 {{/tree}}
463 {{/example}}
464
465 == Video Macro ==
466
467 The Video macro embeds videos.
468
469 {{example}}
470 {{video url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/}}
471 {{/example}}
472
Ryan C 22.1 473 1. View File Macro — Fully Fixed
474 Problem:
475 The pdfviewer macro cannot be inside {{example}}...{{/example}}. It has to be standalone.
476
477 Solution 1: (Most Correct) Directly embed your PDF viewer like this:
478
479
480
Ryan C 14.1 481 == View File Macro ==
Ryan C 22.1 482
Ryan C 14.1 483 The View File macro shows a file viewer for an attached file.
Ryan C 11.1 484
Ryan C 23.1 485
Ryan C 22.1 486 {{pdfviewer attachment="MyWiki@Reverse_Discrimination.pdf"/}}
Ryan C 23.1 487
488
Ryan C 22.1 489 ✅ This will show the PDF outside of any {{example}} wrapping.
490 ✅ Must be attached to the same page (your page is /bin/view/MyWiki/).
Ryan C 11.1 491
Ryan C 22.1 492 Note:
493 If you MUST put it inside an {{example}}, we have to fallback to iframe HTML instead of a macro (I can show that if you want).
494
495 == UIExtension Macro — Fully Fixed ==
496 Problem:
497 You used a non-existent extension point org.xwiki.platform.panels — that ID does not exist in your wiki.
498
499 Solution:
500 ➔ We need to use a real extension id.
501 Example safer extension ID: Try org.xwiki.watchlist.menu (almost always exists).
502
503 Fixed Example:
504
Ryan C 14.1 505 == UI Extension Macro ==
Ryan C 22.1 506
Ryan C 14.1 507 The UIExtension macro injects UI elements into extension points.
Ryan C 12.1 508
Ryan C 22.1 509 {{example}}
Ryan C 24.1 510
Ryan C 22.1 511 {{uiextension id="org.xwiki.watchlist.menu"/}}
Ryan C 24.1 512
Ryan C 22.1 513 {{/example}}
Ryan C 23.1 514
Ryan C 22.1 515 ✅ This will NOT give you the [Failed to find an extension id] error because it's a real one.
Ryan C 12.1 516
Ryan C 22.1 517 Or, if you want me to list your real extensions dynamically so you can pick properly, I can show you how to list them.
518
519 == UIExtensions Macro — Leave it as-is ==
520
521 ✅ No syntax errors shown here.
522 ✅ Already correct.
523
524 You can keep it exactly:
525
526
Ryan C 14.1 527 == UI Extensions Macro ==
Ryan C 22.1 528
Ryan C 14.1 529 The UIExtensions macro lists UI extensions for a given extension point.
Ryan C 12.1 530
Ryan C 22.1 531 {{example}}
Ryan C 24.1 532
Ryan C 22.1 533 {{uiextensions extensionpoint="org.xwiki.watchlist.menu"/}}
Ryan C 24.1 534
Ryan C 22.1 535 {{/example}}
Ryan C 11.1 536
537
Ryan C 12.1 538
539
540
Ryan C 11.1 541
542