0 Votes

MyWiki

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

XWiki Macros Reference Guide

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.

TOC Macro

The TOC macro generates a Table of Contents.

Box Macro

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.

Note

This is a sample box message.

{{box title="Note"}}
This is a sample box message.
{{/box}}

Info Macro

The Info macro displays an informational message in a styled box. It is typically rendered with a blue color to denote general information.

Information

This is an informational message.

{{info}}
This is an informational message.
{{/info}}
Information
FYI

This is an informational message with a title.

{{info title="FYI"}}
This is an informational message with a title.
{{/info}}

Warning Macro

The Warning macro highlights a warning message in a styled box (yellow/orange background).

Warning

This is a warning message.

{{warning}}
This is a warning message.
{{/warning}}

Success Macro

The Success macro displays a success message in a green-styled box.

Success

This is a success message.

{{success}}
This is a success message.
{{/success}}

Error Macro

The Error macro displays a critical error or alert message in a red-styled box.

Error

This is an error message.

{{error}}
This is an error message.
{{/error}}

Chart Macro

The Chart macro generates graphical charts based on input tables.

{{chart type="pie" source="inline" params="range:B2-B4;series:columns;" width="400" height="300"}}
|=Category|=Value|
|A|10|
|B|20|
|C|30|
{{/chart}}

{{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}}

Children Macro

The Children macro lists the child pages of the current page.

{{children/}}

Code Macro

The Code macro highlights and formats source code.

public class Hello {
   public static void main(String[] args) {
        System.out.println("Hello World");
   }
}
{{code language="java"}}
public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}
{{/code}}

Comment Macro

The Comment macro hides content from page rendering.

Visible part 1.

Visible part 2.

Visible part 1.
{{comment}}This text will not be visible.{{/comment}}
Visible part 2.

Container Macro

The Container macro creates multi-column layouts.

Column 1: This is the first column.

Column 2: This is the second column.

{{container layoutStyle="columns"}}
(((**Column 1:** This is the first column.)))
(((**Column 2:** This is the second column.)))
{{/container}}

Dashboard Macro

The Dashboard macro creates areas for gadgets.

{{dashboard columns="2"/}}

Display Macro

The Display macro embeds content from another page.

{{display page="Help.Macros"/}}

DisplayIcon Macro

The DisplayIcon macro displays an icon.

 Home

{{displayIcon name="home"/}} Home

Documents Macro

The Documents macro shows a livetable of documents.

{{documents space="MySpace"/}}

DocumentTree Macro

The DocumentTree macro shows a collapsible page tree.

{{documentTree reference="Help.WebHome"/}}

Footnote Macro

The Footnote macro adds footnotes to the page.

This is a statementSource: Example Reference.
The [putFootnotes] macro is a standalone macro and it cannot be used inline. Click on this message for details.

This is a statement{{footnote}}Source: Example Reference{{/footnote}}.
{{putFootnotes/}}

PutFootnotes Macro

The PutFootnotes macro outputs collected footnotes.

...page content...
The [putFootnotes] macro is a standalone macro and it cannot be used inline. Click on this message for details.

...page content...
{{putFootnotes/}}

Gallery Macro

The Gallery macro displays a collection of images.

{{gallery}}
image:Space.Page@Image1.png
image:Space.Page@Image2.png
{{/gallery}}

Groovy Macro

The Groovy macro executes Groovy scripts.

Hello from Groovy!

{{groovy}}
println("Hello from Groovy!")
{{/groovy}}

HTML Macro

The HTML macro embeds raw HTML into pages.

This is red text via HTML.

{{html}}
<p style="color:red;">This is red text via HTML.</p>
{{/html}}

Id Macro

The Id macro defines an internal link anchor.

Click here to jump.


Target Location: You have reached the target.

Click [[here>>#myanchor]] to jump.

{{id name="myanchor"/}}
**Target Location:** You have reached the target.

Include Macro

The Include macro includes another page's content.

{{include page="Help.Introduction"/}}

Mention Macro

The Mention macro notifies a mentioned user.

Failed to execute the [mention] macro. Cause: [Parameter [reference] is mandatory]. Click on this message for details.

{{mention user="xwiki:JohnDoe"/}}

Notifications Macro

The Notifications macro displays recent activity.

{{notifications/}}

Office Macro

The Office macro displays Office documents.

Failed to execute the [office] macro. Cause: [The wiki needs to be connected to an office server in order to view office files. Ask your administrator to configure such a server.]. Click on this message for details.

{{office attachment="Main.UserGuide@Guide.docx"/}}

Python Macro

The Python macro executes Python scripts.

Hello from Python!

{{python}}
print("Hello from Python!")
{{/python}}

Script Macro

The Script macro executes scripts in different languages.

Failed to execute the [script] macro. Cause: [Can't find script engine with name [velocity]]. Click on this message for details.

{{script language="velocity"}}
#set($name = "Velocity")
Hello $name!
{{/script}}

Tag Cloud Macro

The Tag Cloud macro displays tags visually.

No page has been tagged yet

{{tagcloud/}}

User Avatar Macro

The User Avatar macro shows a user's avatar image.

Invalid macro parameters used for the [useravatar] macro. Cause: [Property [username] mandatory]. Click on this message for details.

{{useravatar user="xwiki:JohnDoe"/}}

Velocity Macro

The Velocity macro executes Velocity scripts.

Hello Alice!

{{velocity}}
#set($name = "Alice")
Hello $name!
{{/velocity}}

Menu Macro

The Menu macro builds a navigation menu.

{{menu}}
* [[Home>>Main.WebHome]]
* [[Products>>Main.Products]]
** [[Product A>>Main.Products.ProductA]]
** [[Product B>>Main.Products.ProductB]]
* [[Contact>>Main.Contact]]
{{/menu}}

Button Macro

The Button macro inserts a styled clickable button.

Failed to execute the [button] macro. Cause: [Parameter [label] is mandatory]. Click on this message for details.

{{button link="https://xwiki.org" style="primary"}}
Click Me
{{/button}}

Carousel Macro

The Carousel macro displays a slideshow of images.

{{carousel}}
image:Space.Page@Image1.png
image:Space.Page@Image2.png
{{/carousel}}

Embed Macro

The Embed macro shows external content like YouTube videos.

{{embed url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/}}

Expandable Macro

The Expandable macro shows expandable hidden content.

Failed to execute the [expandable] macro. Cause: [Parameter [summary] is mandatory]. Click on this message for details.

{{expandable title="Click to Expand"}}
Hidden details appear here.
{{/expandable}}

Excerpt Macro

The Excerpt macro marks content for reuse elsewhere.

Unknown macro: missingLicenseMessage. Click on this message for details.

{{excerpt}}
This is excerpted content.
{{/excerpt}}

FAQ Macro

The FAQ macro lists FAQ entries.

per page of Page
Actions
Warning
The environment prevents the table from loading data.
 
Page
{{faq space="FAQ"/}}

Live Data Macro

The LiveData macro displays dynamic data tables.

{{liveData source="document"/}}

Panel Macro

The Panel macro creates styled content boxes.

Unknown macro: missingLicenseMessage. Click on this message for details.

{{panel title="Panel Title"}}
This is inside a panel.
{{/panel}}

PDF Viewer Macro

The PDFViewer macro embeds PDFs using PDF.js.

Failed to execute the [pdfviewer] macro. Cause: [Parameter [file] is mandatory]. Click on this message for details.

{{pdfviewer attachment="MyPage@file.pdf"/}}

Profile Picture Macro

The Profile Picture macro shows a user’s picture.

Unknown macro: missingLicenseMessage. Click on this message for details.

{{profile-picture user="xwiki:JohnDoe"/}}

Recently Updated Macro

The Recently Updated macro lists recent changes.

Unknown macro: missingLicenseMessage. Click on this message for details.

{{recently-updated/}}

Status Macro

The Status macro adds a colored status label.

Unknown macro: missingLicenseMessage. Click on this message for details.

{{status value="In Progress" color="yellow"/}}

Team Macro

The Team macro shows avatars of a team.

Unknown macro: missingLicenseMessage. Click on this message for details.

{{team space="TeamSpace"/}}

Tooltip Macro

The Tooltip macro shows hints on hover.

Hover .

Hover {{tooltip content="Extra Information"}}here{{/tooltip}}.

Tree Macro

The Tree macro shows a hierarchical list.

{{tree}}

[[Parent>>Parent.Page]]
** [[Child 1>>Parent.Child1]]
** [[Child 2>>Parent.Child2]]
{{/tree}}

Video Macro

The Video macro embeds videos.


{{video url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/}}
  1. View File Macro — Fully Fixed
    Problem:
    The pdfviewer macro cannot be inside The [example] macro is a standalone macro and it cannot be used inline. Click on this message for details.
    . It has to be standalone.

Solution 1: (Most Correct) Directly embed your PDF viewer like this:

View File Macro

The View File macro shows a file viewer for an attached file.

Failed to execute the [pdfviewer] macro. Cause: [Parameter [file] is mandatory]. Click on this message for details.

✅ This will show the PDF outside of any The [example] macro is a standalone macro and it cannot be used inline. Click on this message for details.