XWikiSyntax

Last modified by Administrator on 2008/02/20 12:48

XWiki Syntax

In addition to these special wiki syntaxes XWiki allows any HTML to be inserted in a page so if there no wiki syntax for what you wish to achieve, consider using HTML.

Titles

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> 1 Title 1 1.1 Title 2 1.1.1 Title 3 1.1.1.1 Title 4 1.1.1.1.1 Title 5 1.1.1.1.1.1 Title 6 </pre> </td> <td> <h2><span id="HTitle1">Title 1</span></h2><p class="paragraph"/> <h3><span id="HTitle2">Title 2</span></h3><p class="paragraph"/> <h4><span id="HTitle3">Title 3</span></h4><p class="paragraph"/> <h5><span id="HTitle4">Title 4</span></h5><p class="paragraph"/> <h6><span id="HTitle5">Title 5</span></h6><p class="paragraph"/> <h6><span id="HTitle6">Title 6</span></h6><p class="paragraph"/> </td> </tr> </table>

Paragraphs

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> Here is a paragraph. This text continues the same paragraph.

This paragraph is a new one.

This paragraph is another new one.

This paragraph is displayed\ on two lines. </pre> </td> <td> Here is a paragraph. This text continues the same paragraph.<p class="paragraph"/>This paragraph is a new one.<p class="paragraph"/>This paragraph is another new one.<p class="paragraph"/> This paragraph is displayed<br/>on two lines. </td> </tr> </table>

Lists

Bulleted Lists

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> * Item 1 ** Item 2 *** Item 3 * Item 4 </pre> </td> <td> <ul class="star"> <li>Item 1           <ul class="star"> <li>Item 2               <ul class="star"> <li>Item 3</li> </ul> </li> </ul> </li> <li>Item 4</li> </ul> </td> </tr> </table>

Numbered Lists

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> 1. Item 1 11. Item 2 111. Item 3 1. Item 4

1. Item 1 1*. Item 2 1*. Item 3 1. Item 4

a. Alphabetical enumerated list a. Alphabetical enumerated list

A. Uppercase alphabetical enumerated list A. Uppercase alphabetical enumerated list

i. Roman enumerated list i. Roman enumerated list

I. Uppercase roman enumerated list I. Uppercase roman enumerated list

g. Greek enumerated list g. Greek enumerated list

h. Hirigana (jap.) enumerated list h. Hirigana (jap.) enumerated list

k. Katakana (jap.) enumerated list k. Katakana (jap.) enumerated list </pre> </td> <td> <ol> <li>Item 1           <ol> <li>Item 2               <ol> <li>Item 3</li> </ol> </li> </ol> </li> <li>Item 4</li> </ol>

 <ol> <li>Item 1           <ul class="star"> <li>Item 2</li> <li>Item 3</li> </ul> </li> <li>Item 4</li> </ol>

 <ol class="alpha"> <li>Alphabetical enumerated list</li> <li>Alphabetical enumerated list</li> </ol>

 <ol class="ALPHA"> <li>Uppercase alphabetical enumerated list</li> <li>Uppercase alphabetical enumerated list</li> </ol>

 <ol class="roman"> <li>Roman enumerated list</li> <li>Roman enumerated list</li> </ol>

 <ol class="ROMAN"> <li>Uppercase roman enumerated list</li> <li>Uppercase roman enumerated list</li> </ol>

 <ol class="greek"> <li>Greek enumerated list</li> <li>Greek enumerated list</li> </ol>

 <ol class="hiragana"> <li>Hirigana (jap.) enumerated list</li> <li>Hirigana (jap.) enumerated list</li> </ol>

 <ol class="katakana"> <li>Katakana (jap.) enumerated list</li> <li>Katakana (jap.) enumerated list</li> </ol>

 </td> </tr> </table>

Definition Lists

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> &lt;dl&gt; &lt;dt&gt;Term&lt;/dt&gt; &lt;dd&gt;Definition&lt;/dd&gt; &lt;/dl&gt; </pre> </td> <td> <dl> <dt>Term</dt> <dd>Definition</dd> </dl> </td> </tr> </table>

Text Styles

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> a *bold* word

an __underlined__ word

~~text in italics~~

--striked text--

&lt;tt&gt;text in monospace font&lt;/tt&gt;

Text in a &lt;sup&gt;superscript&lt;/sup&gt; format

Text in a &lt;sub&gt;subscript&lt;/sub&gt; format

>Here is some text with a quote

</pre> </td> <td> a <strong class="strong">bold</strong> word<p class="paragraph"/> an <span class="underline">underlined</span> word<p class="paragraph"/> <em class="italic">text in italics</em><p class="paragraph"/> <del class="strike">striked text</del><p class="paragraph"/> <tt>text in monospace font</tt><p class="paragraph"/> Text in a <sup>superscript</sup> format<p class="paragraph"/> Text in a <sub>subscript</sub> format<p class="paragraph"/> <blockquote class="quote"><p> Here is some text with a quote <a href="http://www.xwiki.org">Source</a> </p></blockquote><p class="paragraph"/> </td> </tr> </table>

Horizontal Line

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> ---- </pre> </td> <td> <hr class="line"/> </td> </tr> </table>

The full format of a link is 

(alias[|>])(link)(@interWikiAlias)([|>]target)
  • alias: An optional string which will be displayed to the user as the link name when rendered. Example: "My Page".
  • link: The full link reference using the following syntax: 
(virtualWikiAlias:)(space.)(reference)(?queryString)(#anchor)
  • Note that either the link or the alias must be specified.
    • virtualWikiAlias: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: "mywiki".
    • space: An optional Wiki Space name. If not space is specified the current space is used. Example: "Main".
    • reference: The link reference. This can be either a URI in the form protocol:path (example: "http://xwiki.org", "john@smith.com") or a wiki page name (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 titles. Example: "TableOfContentAnchor".
  • interWikiAlias: An optional Inter Wiki alias as defined in the InterWiki Map (see the Admin Guide). Example: "wikipedia"
  • target: An optional string corresponding to the HTML 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 page. Examples: "_self", "_blank"
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> [WebHome] (uses current space) [home>WebHome] (uses current space) [Main.WebHome] [home|Main.WebHome] [home>Main.WebHome>_blank] </pre> </td> <td> <span class="wikilink"><a href="/xwiki/bin/view/UserGuide/">Web Home</a></span> (uses current space)<br/> <span class="wikilink"><a href="/xwiki/bin/view/UserGuide/">home</a></span> (uses current space)<br/> <span class="wikilink"><a href="/xwiki/bin/view/Main/">Web Home</a></span><br/> <span class="wikilink"><a href="/xwiki/bin/view/Main/">home</a></span><br/> <span class="wikilink"><a href="/xwiki/bin/view/Main/" rel="__blank">home</a></span> </td> </tr> </table>
<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> http://www.xwiki.org [http://www.xwiki.org] [XWiki>http://www.xwiki.org] </pre> </td> <td> <span class="nobr"><a href="http://www.xwiki.org">http://www.xwiki.org</a></span><br/> <span class="wikiexternallink"><a href="http://www.xwiki.org">&#104;ttp://www.xwiki.org</a></span><br/> <span class="wikiexternallink"><a href="http://www.xwiki.org">XWiki</a></span> </td> </tr> </table>

Tables

The syntax for tables allows to easily create content in table format. It even allows to make some simple calculations on the content!

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> 

|=Title 1|=Title 2
|Word 1|Word 2


|=Category|=Sales (K?)
|Category 1|100
|Category 2|50
|Category 3|50
|Total|=sum(B2:B4)


</pre> </td> <td> <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"> <tr> <th>Title 1</th> <th>Title 2</th> </tr> <tr class="table-odd"> <td>Word 1</td> <td>Word 2</td> </tr> </table> <table class="wiki-table" cellpadding="0" cellspacing="0" border="0"> <tr> <th>Category</th> <th>Sales (K?)</th> </tr> <tr class="table-odd"> <td>Category 1</td> <td>100</td> </tr> <tr class="table-even"> <td>Category 2</td> <td>50</td> </tr> <tr class="table-odd"> <td>Category 3</td> <td>50</td> </tr> <tr class="table-even"> <td>Total</td> <td>200</td> </tr> </table> </td> </tr> </table>

Images

The {image} macro is used to display attachments as images. Check the Image macro reference guide for all options.

Failed to execute the [velocity] macro. Cause: [Lexical error,   Encountered: "#" (35), after : "&" at wikicreole:XWiki.XWikiSyntax[line 15, column 261]]. Click on this message for details.

Escaping wiki syntax rendering

The {pre}{/pre} macro prevents wiki syntax and Radeox macro rendering but preserves HTML rendering and preserves execution of Groovy/Velocity scripts.

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> {&#112;re} No *bold rendering* in wiki syntax. {/&#112;re} </pre> </td> <td> No *bold rendering* in wiki syntax. </td> </tr> </table>

Escaping everything

The {code}{code} macro prevents wiki syntax rendering, HTML rendering and Groovy/Velocity rendering. Check the Code macro reference guide for all options.

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre>

{{code}}
No &lt;strong&gt;bold rendering&lt;/strong&gt; in HTML.
No *bold rendering in* wiki syntax.
{{/code}}

</pre> </td> <td> <div class="code"> <pre>No &#60;strong&#62;bold rendering&#60;/strong&#62; in HTML. No &#42;bold rendering in&#42; wiki syntax.</pre> </div> </td> </tr> </table>

Boxes

Boxes are a nice way to improve on the visual presentation and highlight important elements. The reference documentation for the macros shown below can be found here:

<table class="wiki-table" border="1" cellspacing="0" cellpadding="2" width="80%"> <tr> <th>Example</th> <th>Result</th> </tr> <tr> <td> <pre> #info("This is an information panel")

#warning("This is a warning panel")

#error("This is an error panel")

#startfloatingbox() Some content in a floating box #endfloatingbox() This is a floating box displayed on the right.

#floatingbox("Some content in a floating box") This is also a floating box displayed on the right.

(% style="color:red; background-color:grey; width:300px; height:300px; border:1px solid red; " %)((( This is some content...)))
</pre> </td> <td> <div class="infomessage">This is an information panel</div> <div class="warningmessage"><span class="messagetype">Warning: </span>This is a warning panel</div> <div class="errormessage"><span class="messagetype">Error: </span>This is an error panel</div> <br /><br /> <fieldset class="floatinginfobox"> <legend/> Some content in a floating box </fieldset> This is a floating box displayed on the right.<p class="paragraph"/> <fieldset class="floatinginfobox"><legend/>Some content in a floating box</fieldset> This is also a floating box displayed on the right.<p class="paragraph"/> <div style="color:white; background-color:grey; width:150px; height:50px; border:1px solid black; " > This is some content&#8230; </div> </td> </tr> </table>

Other Macros

XWiki boasts a lot of other very useful macros.

Make sure to check also our Code Zone as we also have Plugins, Code Snippets, Applications and Extensions.