XWiki Syntax Guide
XWiki Syntax 2.1
XWiki Syntax 2.1: All
General
Introduction
2.1 Introduction
The XWiki Syntax 2.0 has proven to be quite useful and robust in general; however since its introduction a few shortcomings have been found. The corresponding improvements have been consolidated in XWiki Syntax 2.1. Some new features of this syntax are:
- Homogenize the link and image syntax for better clarity, consistency and extensibility.
- Added ability to display icons, to embed images via the Data URI scheme, to link to files using the UNC notation and to link to relative URLs.
General Remarks
2.0 General Remarks
XWiki Syntax 2.1 corrects some errors or ambiguous syntax entered by the user as shown in the examples in the table below.
Description | Example of invalid or ambiguous syntax | Fixed XWiki Syntax 2.1 |
---|---|---|
Unclosed text styles | **bold | **bold** |
Two standalone elements not separated by 2 new lines | | table cell * list item | | table cell * list item |
Two standalone elements not separated by 2 new lines | paragraph ---- paragraph | paragraph ---- paragraph |
Ignored new line at beginning of document | <new line at beginning of document> paragraph | paragraph |
Not closed heading syntax | === heading | === heading === |
Other Syntaxes
1.0 Other Syntaxes
Other syntaxes are also available.
Editing
Paragraphs
2.0 Paragraphs
Paragraphs are text elements separated by 2 or more new lines.
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Simple paragraph | This is a paragraph | This is a paragraph |
Paragraph on multiple lines | Paragraph on multiple lines | Paragraph on multiple lines |
Two paragraphs | Paragraph one Paragraph two | Paragraph one Paragraph two |
Parametrized paragraph | (% style="text-align:center;color:blue" %) Centered and blue paragraph | Centered and blue paragraph |
Different style on some portion of the paragraph content | paragraph with (% style="color:red" %)red(%%) different style inside | paragraph with red texte inside |
Headings
2.0 Headings
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Standard headings | = level 1 = == level 2 == === level 3 === ==== level 4 ==== ===== level 5 ===== ====== level 6 ====== | level 1
level 2level 3level 4level 5level 6 |
Parameterized headings | (% style="color:blue" %) = heading = | heading |
Headings with XWiki Syntax | === Heading with **bold** === | Heading with bold |
Text Formatting
2.0 Text Formatting
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Bold | **bold** | bold |
Underline | __underline__ | underline |
Italics | //italic// | italic |
Striked out | --strike-- | |
Monospace | ##monospace## | monospace |
Superscript | some ^^superscript^^ | some superscript |
Subscript | some ,,subscript,, | some subscript |
Horizontal Line
2.0 Horizontal Line
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Simple horizontal line | ---- | |
Parametrized horizontal line | (% style="border-color:blue" %) ---- |
Lists
2.0 Lists
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Bulleted list | * item 1 ** item 2 *** item 3 * item 4 |
|
Numbered list | 1. item 1 11. item 2 111. item 3 1. item 4 |
|
Mixed list | 1. item 1 1*. item 2 1*. item 3 1. item 4 |
|
Square list | (% style="list-style-type: square" %) * item 1 * item 2 |
|
Disc list | (% style="list-style-type: disc" %) * item 1 * item 2 |
|
Lowercase Alphabetical list | (% style="list-style-type: lower-alpha" %) * item 1 * item 2 |
|
Uppercase Alphabetical list | (% style="list-style-type: upper-alpha" %) * item 1 * item 2 |
|
Lowercase Roman list | (% style="list-style-type: lower-roman" %) * item 1 * item 2 |
|
Uppercase Roman list | (% style="list-style-type: upper-roman" %) * item 1 * item 2 |
|
Lowercase Greek list | (% style="list-style-type: lower-greek" %) * item 1 * item 2 |
|
Uppercase Greek list | (% style="list-style-type: upper-greek" %) * item 1 * item 2 |
|
Hiragana list | (% style="list-style-type: hiragana" %) * item 1 * item 2 |
|
Hiragana Iroha list | (% style="list-style-type: hiragana-iroha" %) * item 1 * item 2 |
|
Katakana list | (% style="list-style-type: katakana" %) * item 1 * item 2 |
|
Katakana Iroha list | (% style="list-style-type: katakana-iroha" %) * item 1 * item 2 |
|
Armenian list | (% style="list-style-type: armenian" %) * item 1 * item 2 |
|
Hebrew list | (% style="list-style-type: hebrew" %) * item 1 * item 2 |
|
Georgian list | (% style="list-style-type: georgian" %) * item 1 * item 2 |
|
CJK ideographic list | (% style="list-style-type: cjk-ideographic" %) * item 1 * item 2 |
|
Definition Lists
2.0 Definition Lists
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Standard definition | ; term : definition |
|
Nested definitions | ; term 1 : definition 1 :; term 2 :: definition 2 |
|
Parametrized definition | (% style="color:blue" %) ; term : definition |
|
New Line/Line Breaks
2.0 New Line Line Breaks
A new line is a carriage return. A line break is a forced new line that can appear anywhere in the text.
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Line break | Line\\New line | Line New line |
New line | Line New line | Line New line |
Links
2.1 Links
Funktion | XWiki Syntax 2.1 | Ergebnis |
---|---|---|
Link zu Seite im aktuellen Bereich | [[WebHome]] | XWiki |
Link mit Linktext | [[Linktext>>WebHome]] | Linktext |
Link mit XWiki Syntax im Linktext | [[**fetter Linktext**>>WebHome]] | fetter Linktext |
Link zu Seite im angegebenen Bereich | [[Main.WebHome]] | Main |
Link zu einem Unterwiki | [[subwiki:Main.WebHome]] | Main |
Link der in neuem Fenster öffnet | [[Linktext>>WebHome||rel="__blank"]] | Linktext |
Link zu einer URL direkt im Text | Dies ist eine URL: https://xwiki.org | Dies ist eine URL: https://xwiki.org |
Link zu einer URL | [[https://xwiki.org]] | https://xwiki.org |
Link zu einer URL mit Linktext | [[XWiki>>https://xwiki.org]] | XWiki |
Link zu einer E-Mail-Adresse | [[john@smith.net>>mailto:john@smith.net]] | john@smith.net |
Bild-Link | [[image:Bereich2.Seite2@Bild.png>>Bereich1.Seite1]] | ![]() |
Bild-Link mit Bildparametern | [[[[image:Bereich2.Seite2@Bild.png||width="26" height="26"]]>>Bereich1.Seite1]] | ![]() |
Link zu einem Anhang auf der aktuellen Seite | [[Text>>attach:img.png]] | |
Link zu einem Anhang auf einer anderen Seite | [[Text>>attach:Bereich.Seite@img.png]] | |
Link zu einem Anker auf einer Seite | [[Text>>Bereich.Seite||anchor=anchor]] | Text |
Link zu einer Überschrift auf einer Seite | [[Text>>Bereich.Seite||anchor=HMyheading]] | Text |
XWiki Syntax 2.1 Linkspezifikation
Das vollständige Format eines Links ist [Linktext>>] (Ressource) [||Parameter]
- Linktext: Eine optionale Zeichenkette, welche dem Nutzer beim Rendern als Linkname gezeigt wird. Der Linktext kann XWiki Syntax enthalten. Wenn kein Linktext angegeben ist, wird ein Standartext generiert. Das Erstellungsmuster kann verändert werden, siehe Admin Guide. Beispiel: Meine Seite
- Ressource: Eine erforderliche Zeichenkette mit der Linkreferenz in einer der folgenden Formen
- URL: Eine URL in der Form [url:] (Protokoll://Pfad). Beispiele: http://xwiki.org, url:https://svn.xwiki.org/
- url: Eine optionale Zeichenkette, die die Ressource als URL identifiziert.
- Wikiseitenname Referenz in der Form [doc:] [[wikiName:] Bereich.] (Seite). Beispiele: WebHome, Main.WebHome, mywiki:Main.WebHome
- doc: Eine optionale Zeichenkette, die die Ressource als XWiki Dokument identifiziert.
- wikiName: Eine optionale Zeichenkette, die den Namen des virtuellen Wikis enthält. Der Link wird auf eine Seite in diesem virtuellen Wiki zeigen. Beispiel: mywiki
- Bereich: Ein optionaler Bereichsname. Wenn kein Bereich spezifiziert wird, wird der aktuelle Bereich verwendet. Beispiel: Main
- Seite: Eine erforderliche Zeichenkette, die den Namen der verknüpften Wikiseite enthält. Beispiel: WebHome
- doc: Eine optionale Zeichenkette, die die Ressource als XWiki Dokument identifiziert.
- InterWiki Seitenname Referenz in der Form interwiki: (interWikiAlias:) (Seite). Beispiel: interwiki:wikipedia:XWiki
- interwiki: Eine erforderliche Zeichenkette, die die Ressource als einen InterWiki Link identifiziert.
- interWikiAlias: Ein optionales Inter Wiki Alias, entsprechend der Definition in der InterWiki Map (siehe Admin Guide). Beispiel: wikipedia
- Seite: Eine erforderliche Zeichenkette, die den Namen der verknüpften Wikiseite enthält. Beispiel: XWiki
- Anhang: Referenz in der Form attach:{{{(wikiName):}(spaceNameListe).}(seitenName)@}(anhangsName)
- attach: Eine erforderliche Zeichenfolge, die die Referenz als XWiki-Dokumentanhang identifiziert.
- wikiName: Eine optionale Zeichenfolge, die den Namen eines Wikis enthält. Die Bildreferenz zeigt auf ein Bild, das an eine Seite innerhalb dieses Wikis angehängt ist. Wenn kein Wiki angegeben ist, wird das aktuelle Wiki verwendet. Beispiel: mywiki.
- spaceNameListe: Eine optionale, durch Punkte getrennte Liste von Wiki-Bereichs-Namen. Wenn kein Bereich angegeben ist, wird der aktuelle Bereich verwendet. Beispiele: Main, A.B, A.B.C
- seitenName: Eine optionale Zeichenfolge, die den Namen der Wiki-Seite enthält, an die das referenzierte Bild angehängt ist. Beispiel: Welcome
- anhangsName: Name des Anhangs, wie er im Wiki gespeichert ist.
- E-Mail-Adresse in der Form mailto: (emailAdresse) (#Anker ist nicht zulässig). Beispiel: mailto:john@smith.com
- mailto:: Eine notwendige Zeichenkette, die die Ressource als E-Mail identifiziert.
- emailAddress: Ziel-E-Mail-Adresse. Beispiel: john@smith.com
- Relativer Pfad Referenz auf dem Server in der Form path: (relPfad). Beispiel: path:$doc.getURL('reset') erzeugt Zieladresse http://server.domain.com/xwiki/bin/reset/Space/Page wobei /xwiki/bin/reset/Space/Page durch $doc.getURL('reset') erzeugt wird.
- path: Eine erforderliche Zeichenkette, die die Ressource als relativen Pfad identifiziert.
- relPfad: Eine erforderliche Zeichenkette, die den relativen Pfad der Ressource auf dem Server enthält, die verknüpft werden soll.
- UNC (Windows Explorer) Referenz in der Form unc: (Pfad). Der Link wird als file:// gerendet. Beispiele: unc:C:Windows, unc:~myserverpathimg.png, unc:home/user/somefile
- unc: Eine erforderliche Zeichenkette, die die Ressource als UNC (Windows Explorer) Pfad identifiziert.
- Pfad: Eine erforderliche Zeichenkette, die den lokalen Pfad der Ressource, die dem Nutzer zugänglich ist, enthält. Beispiele: C:Windows, ~myserverpathimg.png, home/user/somefile
- URL: Eine URL in der Form [url:] (Protokoll://Pfad). Beispiele: http://xwiki.org, url:https://svn.xwiki.org/
- Parameter: Eine optionale Liste von Leerzeichen-getrennten Parametern, die an den Link übergeben werden. Beispiel: queryString="mydata1=5&mydata2=Hallo" anchor="HInhaltsverzeichnis" rel="__blank"
- queryString: Eine optionale Abfragezeichenkette, die Parameter spezifiziert, die an die Linkzieladresse angehängt werden und in der gerenderten URL verwendet werden. Beispiel: url:http://domain.com/pfad||queryString="mydata1=5&mydata2=Hello" erzeugt Zieladresse http://domain.com/pfad?mydata1=5&mydata2=Hello
- anchor: Ein optionaler Ankername, der auf einen Anker im referenzierten Link zeigt. In XWiki werden Anker automatisch für Überschriften und Bilder erstellt. Beispiel: url:http://domain.com/pfad||anchor="HInhaltsverzeichnis" erzeugt Zieladresse http://domain.com/pfad#HInhaltsverzeichnis
- rel: Ein optionaler Parameter, der es ermöglicht das Linkziel in einem neuen Fenster zu öffnen. Beispiel: rel="__blank"
Tables
2.0 Tables
Allows to easily create content in table format. Parameters for table, row or cell are also supported in XWiki Syntax 2.1.
Feature | XWiki Syntax 2.1 | Result | ||||||
---|---|---|---|---|---|---|---|---|
Standard table | |=Title 1|=Title 2 |Word 1|Word 2 !=Title 1!=Title 2 !!Word 1!!Word 2 |
| ||||||
Parametrized table | (% style="background-color:red;text-align:center" %) |=Title 1|=(% style="background-color:yellow" %)Title 2 |Word 1|Word 2 |
| ||||||
Filterable Sortable table | {{velocity}} $xwiki.ssfx.use("js/xwiki/table/table.css") $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true) {{/velocity}} (% class="grid sortable filterable doOddEven" id="tableid" %) (% class="sortHeader" %)|=Title 1|=Title 2 |Cell 11|Cell 12 |Cell 21|Cell 22 |
|
Images
2.1 Images
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Image from attachment on current page | image:img.png | ![]() |
Image from attachment on another page | image:PageA.PageB@img.png | ![]() |
Image with parameters | [[image:img.png||width="25" height="25"]] | ![]() |
Image with caption | [[~[~[XWiki~>~>https://www.xwiki.org~]~] supports captions.>>image:img.png]] | ![]() XWiki supports captions. |
Images located at URL | image:https://some/url/img.png | ![]() |
Prepackaged Icons | image:icon:accept | ![]() |
XWiki Syntax 2.1 Image Specification
The full format of an image is either image: (reference) or [[{caption>>}image: (reference) {||parameters}]]
- caption: An optional caption. May contain arbitrary XWiki 2.1 syntax but nested link syntax must be escaped using ~. The caption is only supported when the image syntax is the only content of a paragraph. The captioned image may also be wrapped in a link. In this case, the link will contain the image but not the caption.
- image: A required string identifying the resource as image.
- reference: The reference to the image that shall be displayed in one of the following forms:
- URL: Any URL to an image in the form of [url:](protocol://path/imageName). Example: http://domain.org/path/img.png
- url: An optional string identifying the image as an URL.
- protocol://path/imageName: The URL to the image
- Attachment: A reference in the form [attach:]{{{(wikiName):}(spaceNameList).}(pageName)@}(imageName)
- attach: An optional string identifying the reference as an XWiki Document attachment.
- wikiName: An optional string containing the name of a wiki. The image reference will point to an image attached to a page inside that wiki. If no wiki is specified, the current wiki is used. Example: mywiki.
- spaceNameList: An optional dot-separated list of wiki Space names. If no space is specified the current space is used. Examples: Main, A.B, A.B.C
- pageName: An optional string containing the name of the wiki page to which the referenced image is attached. Example: Welcome
- imageName: A required string containing the name of the image attached to a page as it is stored in the wiki. Example: myImage.png
- Page Attachment: A reference in the form pageAttach:{{{(wikiName):}(pageNameList)/}(imageName)
- pageAttach: An required string identifying the reference as an XWiki Page attachment.
- wikiName: An optional string containing the name of a wiki. The image reference will point to an image attached to a page inside that wiki. If no wiki is specified, the current wiki is used. Example: mywiki.
- pageNameList: An optional dot-separated list of wiki page names. If no page is specified the current page is used. Examples: Main, A/B, A/B/C
- imageName: A required string containing the name of the image attached to a page as it is stored in the wiki. Example: myImage.png
- Icon: A reference in the form icon:(iconName). Example: icon:accept
- icon: A required string identifying the image reference as an icon from the XWiki Icon Set.
- iconName: A required string identifying the icon referenced. Example: accept
- Data URI: A reference in the form (data:)(content). Example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
- data: A required string identifying the image as being specified inline using the Data URI scheme.
- content: The encoded image. Example: image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
- URL: Any URL to an image in the form of [url:](protocol://path/imageName). Example: http://domain.org/path/img.png
- parameters: An optional list of space-separated parameters passed to the image. Example: width="800" height="600" alt="img.png" title="My nice image"
- HTML attributes: All attributes defined by the HTML standard will be added to the rendered HTML <img> tag.
- style: CSS style information that should be applied to the image. Examples: style="float:right;height:50" (image on right side, height 50 px), style="display:block;margin-left:auto;margin-right:auto;width:80%" (image centered, width 80% of block width), style="vertical-align:bottom" (text starts at bottom of picture)
- height: A parameter that defines the height of the displayed image. The value should be presented either in pixel (example: height="80") or in pixel related to the height of the block containing the image (example: height="40%").
- width: A parameter that defines the width of the displayed image. The value should be presented either in pixel (example: width="80") or in pixel related to the width of the block containing the image (example: width="40%").
- title: A parameter that defines the title the displayed image which will be visible when hovering the mouse trigger over the image, for instance. Example: title="My nice image"
- alt: A parameter that defines which text should be displayed if the browser is not able to display the image. Since this is a required HTML attribute XWiki will use the file name instead if the alt parameter is not defined. Example: alt="img.png"
- More: A more in depth explanation on the HTML <img> tag including more attributes can be reviewed in the HTML standard.
- queryString: Allows queries to be passed to the server when creating the download link for the referenced image. Example: queryString="width=100&height=800&keepAspectRatio=true" (keepAspectRatio=true will fail if the width and height parameters are specified in addition to queryString!)
- HTML attributes: All attributes defined by the HTML standard will be added to the rendered HTML <img> tag.
Advanced
Verbatim
2.0 Verbatim
Allow to enter content that will not be formatted (in other words the XWiki Syntax will not be taken into account).
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Verbatim inline | Some verbatim {{{**[[not rendered]]**}}} content | Some verbatim **[[not rendered]]** content |
Verbatim block | {{{ multi line **verbatim** content }}} | multi line **verbatim** content |
Quotations
2.0 Quotations
Allows to quote some text.
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Simple quote | > john said this I said ok |
I said ok |
Nested quotes | > john said this >> marie answered that I said ok |
I said ok |
Groups
2.0 Groups
Groups can be used to insert another document inline directly into the current document. This allows for example to insert complex elements or style inside a list item, inside a table cell or a paragraph. Groups are delimited by the following syntactic elements: (((...))). One Group can contain another Group and there is no limit of imbrication.
XWiki Syntax 2.1 | Result | ||||||
---|---|---|---|---|---|---|---|
|=Header 1|=Header 2|=Header 3 |Cell One|((( = Embedded document = Some embedded paragraph. * list item one * list item two ** sub-item 1 ** sub-item 2 ))) | Cell Three Next paragraph in the top-level document |
Next paragraph in the top-level document | ||||||
(% class="myClass" style="color:blue" %)(((blue paragraphs inside myClass))) | blue paragraphs inside my group |
Escapes
2.0 Escapes
Allows to escape XWiki Syntax.
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Escape a character | This is not a ~[~[link~]~] | This is not a [[link]] |
Escape longer text (also see "Verbatim") | {{{ some **longer** text //without// formatting}}} | some **longer** text //without// formatting |
Parameters
2.0 Parameters
With XWiki Syntax 2.1 it's possible to pass parameters to the different syntax elements and also to blocks of text. This is used for example to style them. You can set any parameter key/value pair you want. The XHTML renderer will pass these parameters as XHTML attributes to the underlying XHTML representation of the different syntax elements.
XWiki Syntax 2.1 | Generated XHTML |
---|---|
(% class="myClass" style="myStyle" id="myId" %) = heading = | <h1 class="myClass" style="myStyle" id="myId">heading</h1> |
Programming
Macros
2.0 Macros
There is only one kind of macro in XWiki Syntax 2.1, which is called by the syntax: {{macroname param1="value1" ... paramN="valueN"}}...{{/macroname}}. For macros without content there's a short notation: {{macroname param1="value1" ... paramN="valueN"/}}
Feature | XWiki Syntax 2.1 | Result |
---|---|---|
Rendering Macro with a content | {{code language="java"}} System.out.println("Hello World!"); {{/code}} | System.out.println("Hello World!"); |
Rendering Macro without content | {{include reference="Space.Page"/}} | The referenced page is included in the current page |
Macros in this wiki
Das Makro [include] konnte nicht ausgeführt werden. Grund: [Current user [null] doesn't have view rights on document [xwiki:XWiki.XWikiSyntaxMacrosList]]. Klicke auf diese Nachricht, um Details zu erfahren.
HTML
2.0 HTML
XWiki Syntax 2.1 | Result |
---|---|
{{html}}<abbr title="HyperText Markup Language">HTML</abbr>{{/html}} | HTML |
Scripts
2.0 Scripts
Feature | XWiki Syntax 2.1 |
---|---|
Velocity script | {{velocity}} #set ($var = "whatever") {{/velocity}} |
Groovy script | {{groovy}} def var = "whatever" {{/groovy}} |