XWiki Syntax Guide

Last modified by Simon Urli on 2020/11/02 15:03

XWiki Syntax 1.0

XWiki Syntax 1.0: All

General

Introduction

1.0 Introduction

The XWiki Syntax 1.0 was the first attempt to implement a Wiki-style Syntax in XWiki. It had some limitations and some formatting can only be achieved by inserting raw HTML. We recommend using the newer syntaxes; XWiki Syntax 1.0 is only supported for backwards compatibility.

In addition to the XWiki-specific syntaxes we've also changed our underlying rendering engine in XWiki 1.7 (was Radeox previously) in favor of our own engine which is superset wrapper around Wikimodel and Doxia (and possibly others in the future). This has allowed us to provide other syntaxes in the wiki: MediaWiki, Confluence, JSPWiki, Creole, TWiki and more.

Other Syntaxes

1.0 Other Syntaxes

Other syntaxes are also available.

Editing

Paragraphs

1.0 Paragraphs

Paragraphs are text elements separated by 2 or more new lines.

New lines are not honored in XWiki Syntax 1.0.
You need to insert a double backslash instead, like: \\

FeatureXWiki Syntax 1.0Result
Simple paragraphThis is a paragraphThis is a paragraph
Paragraph on multiple linesParagraph on\\
multiple lines
Paragraph on
multiple lines
Two paragraphsParagraph one

Paragraph two
Paragraph one

Paragraph two
Parametrized paragraph<p style="text-align:center;color:blue">Centered and blue paragraph</p>
Centered and blue paragraph

Headings

1.0 Headings

FeatureXWiki Syntax 1.0Result
Standard headings

1 level 1
1.1 level 2
1.1.1 level 3
1.1.1.1 level 4
1.1.1.1.1 level 5
1.1.1.1.1.1 level 6

level 1

 

level 2

level 3

level 4

level 5
level 6
Parameterized headings<h1><span style="color:blue">Heading</span></h1>

heading

Headings with XWiki Syntax1.1.1 Heading with *bold*

Heading with bold

Text Formatting

1.0 Text Formatting

FeatureXWiki Syntax 1.0Result
Bold*bold*bold
Underline__underline___underline
Italics~~italic~~italic
Striked out--strike--strike
Monospace<tt>monospace</tt>monospace
Superscriptsome <sup>superscript</sup>some superscript
Subscriptsome <sub>subscript</sub>some subscript

Horizontal Line

1.0 Horizontal Line

There must be 4 or more dashes.

FeatureXWiki Syntax 1.0Result
Simple horizontal line----

Parametrized horizontal line<hr style="border-color:blue"/>

Lists

1.0 Lists

Some of the mentioned styles do not work on all browsers. For a comprehensive list follow this link.

FeatureXWiki Syntax 1.0Result
Bulleted list
* item 1
** item 2
*** item 3
* item 4
  • item 1
    • item 2
      • item 3
  • item 4
Numbered list
1. item 1
11. item 2
111. item 3
1. item 4
  1. item 1
    1. item 2
      1. item 3
  2. item 4
Mixed list
1. item 1
1*. item 2
1*. item 3
1. item 4
  1. item 1
    • item 2
    • item 3
  2. item 4
Square list
- item 1
- item 2
  • item 1
  • item 2
Disc list

<ul style="list-style-type: disc">
  <li>item 1</li>
  <li>item 2</li>
</ul>

  • item 1
  • item 2
Lowercase Alphabetical list
a. item 1
a. item 2
  • item 1
  • item 2
Uppercase Alphabetical list
A. item 1
A. item 2
  • item 1
  • item 2
Lowercase Roman list
i. item 1
i. item 2
  • item 1
  • item 2
Uppercase Roman list
I. item 1
I. item 2
  • item 1
  • item 2
Lowercase Greek list
g. item 1
g. item 2
  • item 1
  • item 2
Uppercase Greek list
G. item 1
G. item 2
  • item 1
  • item 2
Hiragana list
h. item 1
h. item 2
  • item 1
  • item 2
Hiragana Iroha list
H. item 1
H. item 2
  • item 1
  • item 2
Katakana list
k. item 1
k. item 2
  • item 1
  • item 2
Katakana Iroha list
K. item 1
K. item 2
  • item 1
  • item 2
Armenian list
<ul style="list-style-type: armenian">
  <li>item 1</li>
  <li>item 2</li>
</ul>
  • item 1
  • item 2
Hebrew list
j. item 1
j. item 2
  • item 1
  • item 2
Georgian list
<ul style="list-style-type: georgian">
  <li>item 1</li>
  <li>item 2</li>
</ul>
  • item 1
  • item 2
CJK ideographic list
<ul style="list-style-type: cjk-ideographic">
  <li>item 1</li>
  <li>item 2</li>
</ul>
  • item 1
  • item 2

Definition Lists

1.0 Definition Lists

FeatureXWiki Syntax 1.0Result
Standard definition
<dl>
  <dt>term</dt>
  <dd>definition</dd>
</dl>
term
definition
Nested definitions
<dl>
  <dt>term 1</dt>
  <dd>definition 1
    <dl>
      <dt>term 2</dt>
      <dd>definition 2</dd>
    </dl>
  </dd>
</dl>
term 1
definition 1
term 2
definition 2
Parametrized definition
<dl style="color:blue">
  <dt>term</dt>
  <dd>definition</dd>
</dl>
term
definition

New Line/Line Breaks

1.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.

New lines are not honored in XWiki Syntax 1.0. Use line breaks instead.

FeatureXWiki Syntax 1.0Result
Line breakLine\\New lineLine
New line
New lineLine
New line
Line New line
FeatureXWiki Syntax 1.0Result
Link to a page in the current Space[WebHome]Web Home
Link with a label[label>WebHome]label
Link with XWiki Syntax in the label<a href="$xwiki.getURL("WebHome")"><strong>bold label</strong></a>bold label
Link to a page with the space specified[Main.WebHome]Web Home
Link to a subwiki[subwiki:Main.WebHome]Web Home
Link that opens in a new window[label>WebHome>_blank]label
Link to a URL directly in the textThis is a URL: https://xwiki.orgThis is a URL: https://xwiki.org
Link to a URL[https://xwiki.org]https://xwiki.org
Link to a URL with a label[XWiki>https://xwiki.org]XWiki
Link to an email address[[email protected]>mailto:[email protected]][email protected]
Image Link<a href="$xwiki.getURL("Space1.Page1")">{image:img.png|document=Space2.Page2}</a>img.png
Image Link with image parameters<a href="$xwiki.getURL("Space1.Page1")">{image:img.png|document=Space2.Page2|width=26|height=26}</a>img.png
Link to an attachment on the current page

See Attach Macro for details
{attach:text|file=img.png}

text
Link to an attachment in a different page

See Attach Macro for details
{attach:text|document=Space.Page|file=img.png}

text
Link to an Anchor in a page[label>Space.Page#anchor]label
Link to a Heading in a page
[label>Space.Page#HMyheading]
label

When you add a Heading, an anchor named "H" followed by the heading title with only alpha characters is created. For example, for a Heading named "My heading", the generated anchor will be "HMyheading".

XWiki Syntax 1.0 Link Specification

Part in ( ) is required, parts in [ ] are optional and one of the two chars in { } needs to be added if optional parts are being used.

The full format of a link is [label {> or |}] (resource) [@interWikiAlias] [{> or |} target]

  • label: An optional string which will be displayed to the user as the link name when rendered. Example: My Page
  • resource: The full link reference using the following syntax: (reference) [?queryString] [#anchor]
    • reference: The link reference. This can be either
      • A URI in the form protocol:path (examples: http://xwiki.org, mailto:[email protected]), or
      • A wiki page reference in the form [[wikiName:] spaceNameList.] (pageName). Examples: WebHome, Main.WebHome, mywiki:Main.WebHome
        • wikiName: An optional string containing the name of a wiki. The link will point to a page inside that wiki. 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: A required string containing the name of the linked wiki page. Example: WebHome
    • queryString: An optional query string for specifying parameters that will be used in the rendered URL. Example: mydata1=5&mydata2=Hello
    • anchor: An optional anchor name pointing to an anchor defined in the referenced link. Note that in XWiki anchors are automatically created for headings. Example: HTableOfContents
  • interWikiAlias: An optional Inter Wiki alias as defined in the InterWiki Map (see the Admin Guide). This is only valid for wiki page names. Example: wikipedia
  • target: An optional string corresponding to the Hhttps://TML target attribute for a HTML A link element. This element is used when rendering the link. It defaults to opening the link in the current window. Examples: _self, _blank

Tables

1.0 Tables

Allows to easily create content in table format.

FeatureXWiki Syntax 1.0Result
Standard table
{table}
Title 1 | Title 2
Word 1 | Word 2
{table}
Title 1Title 2
Word 1Word 2
Parametrized table

<table style="background-color:red;text-align:center">
  <tbody>
    <tr>
      <td>Title 1</td>
      <td style="background-color:yellow">Title 2</td>
    </tr>
    <tr>
      <td>Word 1</td>
      <td>Word 2</td>
    </tr>
  </tbody>
</table>

Title 1Title 2
Word 1Word 2
Filterable Sortable table
$xwiki.ssfx.use("js/xwiki/table/table.css")
$xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
<table id="table1id" class="grid sortable filterable doOddEven">
  <tr class="sortHeader">
    <th>Title 1</th>
    <th>Title 2</th>
  </tr>
  <tr>
   <td>Cell 11</td>
   <td>Cell 12</td>
  </tr>
  <tr>
   <td>Cell 21</td>
   <td>Cell 22</td>
  </tr>
</table>

For improved features see the Livetable Macro.

Title 1Title 2
Cell 11Cell 12
Cell 21Cell 22

Images

1.0 Images

FeatureXWiki Syntax 1.0Result
Image from attachment on current page

See Image Macro for details
{image:img.png}

img.png
Image from attachment on another page{image:img.png|document=Space.Page}img.png
Image with parameters{image:img.png|width=25|height=25}img.png
Images located at URLhttps://some/url/img.pngimg.png

Advanced

Verbatim

1.0 Verbatim

Allow to enter content that will not be formatted (in other words the XWiki Syntax will not be taken into account).

In XWiki Syntax 1.0 the Pre macro only preserves XWiki Syntax and Radeox macros. However HTML snippets and Groovy/Velocity scripts are still executed.

FeatureXWiki Syntax 1.0Result
Verbatim inlineSome verbatim {pre}*[not rendered]*{/pre} contentSome verbatim *[not rendered]* content
Verbatim block

{pre} multi line *verbatim* content {/pre}
It's also possible to use the Code macro but it displays its content in a box by default.

multi line
*verbatim*
content

Quotations

1.0 Quotations

Allows to quote some text.

FeatureXWiki Syntax 1.0Result
Simple quote

<blockquote><p>john said this</p></blockquote>
I said ok

 john said this

I said ok

Nested quotes

<blockquote><p>john said this</p>
  <blockquote><p>marie answered that</p></blockquote>
</blockquote>
I said ok 

 john said this

 marie answered that

I said ok

Escapes

1.0 Escapes

Allows to escape XWiki Syntax.

FeatureXWiki Syntax 1.0Result
Escape a characterThis is not a \[link\]This is not a [link]

Parameters

1.0 Parameters

In XWiki Syntax 1.0 there is no syntax for passing parameters and the only way to do it was to write XHTML directly in the content as shown in the table below.

XWiki Syntax 1.0Generated XHTML
<h1 class="myClass" style="myStyle" id="myId">heading</h1>
<h1 class="myClass" style="myStyle" id="myId">heading</h1>

Programming

Macros

1.0 Macros

There are two kinds of macros in XWiki Syntax 1.0:

  • Velocity macros (called using the #macroname(param1 ... paramN) syntax)
  • Radeox macros (called using the {macroname:param1=value1|...|paramN=valueN} syntax)

For the full list of available macros check the Extensions wiki.

FeatureXWiki Syntax 1.0
Velocity Macro
#info("Some text")
Radeox Macro
{code:java}
java content
{code}

HTML

1.0 HTML

It is possible to enter HTML markup directly in the text in XWiki Syntax 1.0.

XWiki Syntax 1.0Result
<abbr title="HyperText Markup Language">HTML</abbr>HTML

Scripts

1.0 Scripts

In XWiki Syntax 1.0 it was possible to enter Velocity scripts anywhere directly in the page. This can lead to issues for example when the user was involuntarily entering Velocity content. It is also performance hungry for pages not requiring Velocity content. There are several other technical limitations. Same goes for entering Groovy scripts.

FeatureXWiki Syntax 1.0
Velocity script
#set ($var = "whatever")
Groovy script
<%
def var = "whatever"
%>
  • Powered by XWiki 15.10.8-node2. Hosted and managed by XWiki SAS

Get Connected