Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
10.1 | 1 | = XWiki Macros Reference Guide = |
![]() |
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 | |||
![]() |
10.1 | 6 | == TOC Macro == |
![]() |
9.1 | 7 | |
![]() |
10.1 | 8 | The **TOC** macro generates a Table of Contents. |
![]() |
9.1 | 9 | |
![]() |
10.1 | 10 | {{example}} |
11 | {{toc/}} | ||
12 | {{/example}} | ||
![]() |
9.1 | 13 | |
![]() |
10.1 | 14 | == Box Macro == |
![]() |
9.1 | 15 | |
![]() |
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. |
![]() |
9.1 | 17 | |
![]() |
10.1 | 18 | {{example}} |
19 | {{box title="Note"}} | ||
20 | This is a sample box message. | ||
21 | {{/box}} | ||
22 | {{/example}} | ||
![]() |
9.1 | 23 | |
![]() |
10.1 | 24 | == Info Macro == |
![]() |
9.1 | 25 | |
![]() |
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. |
![]() |
9.1 | 27 | |
![]() |
10.1 | 28 | {{example}} |
29 | {{info}} | ||
![]() |
9.1 | 30 | This is an informational message. |
![]() |
10.1 | 31 | {{/info}} |
32 | {{/example}} | ||
![]() |
9.1 | 33 | |
![]() |
10.1 | 34 | {{example}} |
35 | {{info title="FYI"}} | ||
36 | This is an informational message with a title. | ||
37 | {{/info}} | ||
38 | {{/example}} | ||
![]() |
9.1 | 39 | |
![]() |
10.1 | 40 | == Warning Macro == |
![]() |
9.1 | 41 | |
![]() |
10.1 | 42 | The **Warning** macro highlights a warning message in a styled box (yellow/orange background). |
![]() |
9.1 | 43 | |
![]() |
10.1 | 44 | {{example}} |
45 | {{warning}} | ||
![]() |
9.1 | 46 | This is a warning message. |
![]() |
10.1 | 47 | {{/warning}} |
48 | {{/example}} | ||
![]() |
9.1 | 49 | |
![]() |
10.1 | 50 | == Success Macro == |
![]() |
9.1 | 51 | |
![]() |
10.1 | 52 | The **Success** macro displays a success message in a green-styled box. |
![]() |
9.1 | 53 | |
![]() |
10.1 | 54 | {{example}} |
55 | {{success}} | ||
![]() |
9.1 | 56 | This is a success message. |
![]() |
10.1 | 57 | {{/success}} |
58 | {{/example}} | ||
![]() |
9.1 | 59 | |
![]() |
10.1 | 60 | == Error Macro == |
![]() |
9.1 | 61 | |
![]() |
10.1 | 62 | The **Error** macro displays a critical error or alert message in a red-styled box. |
![]() |
9.1 | 63 | |
![]() |
10.1 | 64 | {{example}} |
65 | {{error}} | ||
![]() |
9.1 | 66 | This is an error message. |
![]() |
10.1 | 67 | {{/error}} |
68 | {{/example}} | ||
![]() |
9.1 | 69 | |
![]() |
10.1 | 70 | == Chart Macro == |
![]() |
9.1 | 71 | |
![]() |
10.1 | 72 | The **Chart** macro generates graphical charts based on input tables. |
![]() |
9.1 | 73 | |
![]() |
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}} | ||
![]() |
9.1 | 82 | |
![]() |
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}} | ||
![]() |
9.1 | 91 | |
![]() |
10.1 | 92 | == Children Macro == |
![]() |
9.1 | 93 | |
![]() |
10.1 | 94 | The **Children** macro lists the child pages of the current page. |
![]() |
9.1 | 95 | |
![]() |
10.1 | 96 | {{example}} |
![]() |
9.1 | 97 | {{children/}} |
![]() |
10.1 | 98 | {{/example}} |
![]() |
9.1 | 99 | |
![]() |
10.1 | 100 | == Code Macro == |
![]() |
9.1 | 101 | |
![]() |
10.1 | 102 | The **Code** macro highlights and formats source code. |
![]() |
9.1 | 103 | |
![]() |
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 | } | ||
![]() |
9.1 | 111 | {{/code}} |
![]() |
10.1 | 112 | {{/example}} |
![]() |
9.1 | 113 | |
![]() |
10.1 | 114 | == Comment Macro == |
![]() |
9.1 | 115 | |
![]() |
10.1 | 116 | The **Comment** macro hides content from page rendering. |
![]() |
9.1 | 117 | |
![]() |
10.1 | 118 | {{example}} |
119 | Visible part 1. | ||
120 | {{comment}}This text will not be visible.{{/comment}} | ||
121 | Visible part 2. | ||
122 | {{/example}} | ||
![]() |
9.1 | 123 | |
![]() |
10.1 | 124 | == Container Macro == |
![]() |
9.1 | 125 | |
![]() |
10.1 | 126 | The **Container** macro creates multi-column layouts. |
![]() |
9.1 | 127 | |
![]() |
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}} | ||
![]() |
9.1 | 134 | |
![]() |
10.1 | 135 | == Dashboard Macro == |
![]() |
9.1 | 136 | |
![]() |
10.1 | 137 | The **Dashboard** macro creates areas for gadgets. |
![]() |
9.1 | 138 | |
![]() |
10.1 | 139 | {{example}} |
![]() |
9.1 | 140 | {{dashboard columns="2"/}} |
![]() |
10.1 | 141 | {{/example}} |
![]() |
9.1 | 142 | |
![]() |
10.1 | 143 | == Display Macro == |
![]() |
9.1 | 144 | |
![]() |
10.1 | 145 | The **Display** macro embeds content from another page. |
![]() |
9.1 | 146 | |
![]() |
10.1 | 147 | {{example}} |
![]() |
9.1 | 148 | {{display page="Help.Macros"/}} |
![]() |
10.1 | 149 | {{/example}} |
![]() |
9.1 | 150 | |
![]() |
10.1 | 151 | == DisplayIcon Macro == |
![]() |
9.1 | 152 | |
![]() |
10.1 | 153 | The **DisplayIcon** macro displays an icon. |
![]() |
9.1 | 154 | |
![]() |
10.1 | 155 | {{example}} |
![]() |
9.1 | 156 | {{displayIcon name="home"/}} Home |
![]() |
10.1 | 157 | {{/example}} |
![]() |
9.1 | 158 | |
![]() |
10.1 | 159 | == Documents Macro == |
![]() |
9.1 | 160 | |
![]() |
10.1 | 161 | The **Documents** macro shows a livetable of documents. |
![]() |
9.1 | 162 | |
![]() |
10.1 | 163 | {{example}} |
![]() |
9.1 | 164 | {{documents space="MySpace"/}} |
![]() |
10.1 | 165 | {{/example}} |
![]() |
9.1 | 166 | |
![]() |
10.1 | 167 | == DocumentTree Macro == |
![]() |
9.1 | 168 | |
![]() |
10.1 | 169 | The **DocumentTree** macro shows a collapsible page tree. |
![]() |
9.1 | 170 | |
![]() |
10.1 | 171 | {{example}} |
![]() |
9.1 | 172 | {{documentTree reference="Help.WebHome"/}} |
![]() |
10.1 | 173 | {{/example}} |
![]() |
9.1 | 174 | |
![]() |
10.1 | 175 | == Footnote Macro == |
![]() |
9.1 | 176 | |
![]() |
10.1 | 177 | The **Footnote** macro adds footnotes to the page. |
![]() |
9.1 | 178 | |
![]() |
10.1 | 179 | {{example}} |
180 | This is a statement{{footnote}}Source: Example Reference{{/footnote}}. | ||
181 | {{putFootnotes/}} | ||
182 | {{/example}} | ||
![]() |
9.1 | 183 | |
![]() |
10.1 | 184 | == PutFootnotes Macro == |
![]() |
9.1 | 185 | |
![]() |
10.1 | 186 | The **PutFootnotes** macro outputs collected footnotes. |
![]() |
9.1 | 187 | |
![]() |
10.1 | 188 | {{example}} |
189 | ...page content... | ||
190 | {{putFootnotes/}} | ||
191 | {{/example}} | ||
![]() |
9.1 | 192 | |
![]() |
10.1 | 193 | == Gallery Macro == |
![]() |
9.1 | 194 | |
![]() |
10.1 | 195 | The **Gallery** macro displays a collection of images. |
![]() |
9.1 | 196 | |
![]() |
10.1 | 197 | {{example}} |
198 | {{gallery}} | ||
199 | image:Space.Page@Image1.png | ||
200 | image:Space.Page@Image2.png | ||
201 | {{/gallery}} | ||
202 | {{/example}} | ||
![]() |
9.1 | 203 | |
![]() |
10.1 | 204 | == Groovy Macro == |
![]() |
9.1 | 205 | |
![]() |
10.1 | 206 | The **Groovy** macro executes Groovy scripts. |
![]() |
9.1 | 207 | |
![]() |
10.1 | 208 | {{example}} |
209 | {{groovy}} | ||
210 | println("Hello from Groovy!") | ||
211 | {{/groovy}} | ||
212 | {{/example}} | ||
![]() |
9.1 | 213 | |
![]() |
10.1 | 214 | == HTML Macro == |
![]() |
9.1 | 215 | |
![]() |
10.1 | 216 | The **HTML** macro embeds raw HTML into pages. |
![]() |
9.1 | 217 | |
![]() |
10.1 | 218 | {{example}} |
219 | {{html}} | ||
220 | <p style="color:red;">This is red text via HTML.</p> | ||
221 | {{/html}} | ||
222 | {{/example}} | ||
![]() |
9.1 | 223 | |
![]() |
10.1 | 224 | == Id Macro == |
![]() |
9.1 | 225 | |
![]() |
10.1 | 226 | The **Id** macro defines an internal link anchor. |
![]() |
9.1 | 227 | |
![]() |
10.1 | 228 | {{example}} |
229 | Click [[here>>#myanchor]] to jump. | ||
![]() |
9.1 | 230 | |
![]() |
10.1 | 231 | {{id name="myanchor"/}} |
232 | **Target Location:** You have reached the target. | ||
233 | {{/example}} | ||
![]() |
9.1 | 234 | |
![]() |
10.1 | 235 | == Include Macro == |
![]() |
9.1 | 236 | |
![]() |
10.1 | 237 | The **Include** macro includes another page's content. |
![]() |
9.1 | 238 | |
![]() |
10.1 | 239 | {{example}} |
![]() |
9.1 | 240 | {{include page="Help.Introduction"/}} |
![]() |
10.1 | 241 | {{/example}} |
![]() |
9.1 | 242 | |
![]() |
10.1 | 243 | == Mention Macro == |
![]() |
9.1 | 244 | |
![]() |
10.1 | 245 | The **Mention** macro notifies a mentioned user. |
![]() |
9.1 | 246 | |
![]() |
10.1 | 247 | {{example}} |
![]() |
9.1 | 248 | {{mention user="xwiki:JohnDoe"/}} |
![]() |
10.1 | 249 | {{/example}} |
![]() |
9.1 | 250 | |
![]() |
10.1 | 251 | == Notifications Macro == |
![]() |
9.1 | 252 | |
![]() |
10.1 | 253 | The **Notifications** macro displays recent activity. |
![]() |
9.1 | 254 | |
![]() |
10.1 | 255 | {{example}} |
![]() |
9.1 | 256 | {{notifications/}} |
![]() |
10.1 | 257 | {{/example}} |
![]() |
9.1 | 258 | |
![]() |
10.1 | 259 | == Office Macro == |
![]() |
9.1 | 260 | |
![]() |
10.1 | 261 | The **Office** macro displays Office documents. |
![]() |
9.1 | 262 | |
![]() |
10.1 | 263 | {{example}} |
![]() |
9.1 | 264 | {{office attachment="Main.UserGuide@Guide.docx"/}} |
![]() |
10.1 | 265 | {{/example}} |
![]() |
9.1 | 266 | |
![]() |
10.1 | 267 | == Python Macro == |
![]() |
9.1 | 268 | |
![]() |
10.1 | 269 | The **Python** macro executes Python scripts. |
![]() |
9.1 | 270 | |
![]() |
10.1 | 271 | {{example}} |
272 | {{python}} | ||
273 | print("Hello from Python!") | ||
274 | {{/python}} | ||
275 | {{/example}} | ||
![]() |
9.1 | 276 | |
![]() |
10.1 | 277 | == Script Macro == |
![]() |
9.1 | 278 | |
![]() |
10.1 | 279 | The **Script** macro executes scripts in different languages. |
![]() |
9.1 | 280 | |
![]() |
10.1 | 281 | {{example}} |
282 | {{script language="velocity"}} | ||
283 | #set($name = "Velocity") | ||
284 | Hello $name! | ||
285 | {{/script}} | ||
286 | {{/example}} | ||
![]() |
9.1 | 287 | |
![]() |
10.1 | 288 | == Tag Cloud Macro == |
![]() |
9.1 | 289 | |
![]() |
10.1 | 290 | The **Tag Cloud** macro displays tags visually. |
![]() |
9.1 | 291 | |
![]() |
10.1 | 292 | {{example}} |
![]() |
9.1 | 293 | {{tagcloud/}} |
![]() |
10.1 | 294 | {{/example}} |
![]() |
9.1 | 295 | |
![]() |
10.1 | 296 | == User Avatar Macro == |
![]() |
9.1 | 297 | |
![]() |
10.1 | 298 | The **User Avatar** macro shows a user's avatar image. |
![]() |
9.1 | 299 | |
![]() |
10.1 | 300 | {{example}} |
301 | {{useravatar user="xwiki:JohnDoe"/}} | ||
302 | {{/example}} | ||
![]() |
9.1 | 303 | |
![]() |
10.1 | 304 | == Velocity Macro == |
![]() |
9.1 | 305 | |
![]() |
10.1 | 306 | The **Velocity** macro executes Velocity scripts. |
![]() |
9.1 | 307 | |
![]() |
10.1 | 308 | {{example}} |
309 | {{velocity}} | ||
310 | #set($name = "Alice") | ||
311 | Hello $name! | ||
312 | {{/velocity}} | ||
313 | {{/example}} | ||
![]() |
9.1 | 314 | |
![]() |
10.1 | 315 | == Menu Macro == |
![]() |
9.1 | 316 | |
![]() |
10.1 | 317 | The **Menu** macro builds a navigation menu. |
![]() |
9.1 | 318 | |
![]() |
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}} | ||
![]() |
9.1 | 328 | |
![]() |
11.1 | 329 | == Button Macro == |
![]() |
9.1 | 330 | |
![]() |
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 | |||
![]() |
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 | |||
![]() |
14.1 | 481 | == View File Macro == |
![]() |
22.1 | 482 | |
![]() |
14.1 | 483 | The View File macro shows a file viewer for an attached file. |
![]() |
11.1 | 484 | |
![]() |
23.1 | 485 | |
![]() |
22.1 | 486 | {{pdfviewer attachment="MyWiki@Reverse_Discrimination.pdf"/}} |
![]() |
23.1 | 487 | |
488 | |||
![]() |
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/). | ||
![]() |
11.1 | 491 | |
![]() |
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 | |||
![]() |
14.1 | 505 | == UI Extension Macro == |
![]() |
22.1 | 506 | |
![]() |
14.1 | 507 | The UIExtension macro injects UI elements into extension points. |
![]() |
12.1 | 508 | |
![]() |
22.1 | 509 | {{example}} |
![]() |
24.1 | 510 | |
![]() |
22.1 | 511 | {{uiextension id="org.xwiki.watchlist.menu"/}} |
![]() |
24.1 | 512 | |
![]() |
22.1 | 513 | {{/example}} |
![]() |
23.1 | 514 | |
![]() |
22.1 | 515 | ✅ This will NOT give you the [Failed to find an extension id] error because it's a real one. |
![]() |
12.1 | 516 | |
![]() |
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 | |||
![]() |
14.1 | 527 | == UI Extensions Macro == |
![]() |
22.1 | 528 | |
![]() |
14.1 | 529 | The UIExtensions macro lists UI extensions for a given extension point. |
![]() |
12.1 | 530 | |
![]() |
22.1 | 531 | {{example}} |
![]() |
24.1 | 532 | |
![]() |
22.1 | 533 | {{uiextensions extensionpoint="org.xwiki.watchlist.menu"/}} |
![]() |
24.1 | 534 | |
![]() |
22.1 | 535 | {{/example}} |
![]() |
11.1 | 536 | |
537 | |||
![]() |
12.1 | 538 | |
539 | |||
540 | |||
![]() |
11.1 | 541 | |
542 |