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