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.
Since XWiki Syntax 2.1 is based on XWiki Syntax 2.0 all syntax from XWiki Syntax 2.0 is valid unless the 2.1 specifications suggest differently.

In addition to these XWiki-specific syntaxes we've also changed our underlying rendering engine in XWiki Enterprise version 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.

General Remarks

Failed to execute the [include] macro. Click on this message for details.

Other Syntaxes

Failed to execute the [include] macro. Click on this message for details.

Editing

Paragraphs

Failed to execute the [include] macro. Click on this message for details.

Headings

Failed to execute the [include] macro. Click on this message for details.

Text Formatting

Failed to execute the [include] macro. Click on this message for details.

Horizontal Line

Failed to execute the [include] macro. Click on this message for details.

Lists

Failed to execute the [include] macro. Click on this message for details.

Definition Lists

Failed to execute the [include] macro. Click on this message for details.

New Line/Line Breaks

Failed to execute the [include] macro. Click on this message for details.
FeatureXWiki Syntax 2.1Result
Link to a page in the current Space[[WebHome]]WebHome
Link with a label

[[label>>WebHome]]
XWiki Syntax is supported inside link labels.

label
Link with XWiki Syntax in the label[[**bold label**>>WebHome]]bold label
Link to a page with the space specified[[Main.WebHome]]WebHome
Link to a subwiki[[subwiki:Main.WebHome]]WebHome
Link that opens in a new window[[label>>WebHome||rel="__blank"]]label
Link to a URL directly in the textThis is a URL: http://xwiki.orgThis is a URL: http://xwiki.org
Link to a URL[[http://xwiki.org]]http://xwiki.org
Link to a URL with a label[[XWiki>>http://xwiki.org]]XWiki
Link to an email address[[john@smith.net>>mailto:john@smith.net]]john@smith.net
Image Link[[image:Space2.Page2@img.png>>Space1.Page1]]img.png
Image Link with image parameters[[[[image:Space2.Page2@img.png||width="26" height="26"]]>>Space1.Page1]]img.png
Link to an attachment on the current page[[text>>attach:img.png]]text
Link to an attachment in a different page[[text>>attach:Space.Page@img.png]]text
Link to an Anchor in a page[[label>>Space.Page||anchor="anchor"]]label
Link to a Heading in a page[[label>>XWiki.XWikiSyntax||anchor="HMyheading"]]label
Link to an Anchor in the current page[[label>>||anchor="anchor"]]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 2.1 Link Specification

The part in ( ) is required, while the parts in [ ] are optional.

The full format of a link is [label>>] (resource) [||parameters]

  • label: An optional string which will be displayed to the user as the link name when rendered. The label may contain XWiki Syntax. If no label is specified a default label will be generated. The generation pattern can be changed, see the Admin Guide. Example: My Page
  • resource: A required string with the link reference in one of the following forms
    • URL: Any URL in the form of [url:] (protocol://path). Examples: http://xwiki.org, url:https://svn.xwiki.org/
      • url: An optional string identifying the resource as an URL.
    • Wiki page name reference in the form [doc:] [[wikiName:] space.] (page). Examples: WebHome, Main.WebHome, mywiki:Main.WebHome
      • doc: An optional string identifying the resource as an XWiki document.
      • wikiName: 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 no space is specified the current space is used. Example: Main
      • page: A required string containing the name of the linked wiki page. Example: WebHome
    • InterWiki page name reference in the form interwiki: (interWikiAlias:) (page). Example: interwiki:wikipedia:XWiki
      • interwiki: A required string identifying the resource as an InterWiki link.
      • interWikiAlias: An optional Inter Wiki alias as defined in the InterWiki Map (see the Admin Guide). Example: wikipedia
      • page: A required string containing the name of the linked page. Example: XWiki
    • Attachment reference in the form attach: [wikiPageName@] (attachmentName). Examples: attach:img.png, attach:mywiki:Main.WebHome@img.png
      • attach:: A required string identifying the resource as attachment.
      • wikiPageName: An optional string referencing the document that holds the attachment, see "Wiki page name" above.
      • attachmentName: Name of the attachment as it is stored in the wiki.
    • Email address in the form mailto: (emailAddress) (#anchor is not valid). Example: mailto:john@smith.com
      • mailto:: A required string identifying the resource as email.
      • emailAddress: Targeted email address. Example: john@smith.com
    • Relative path reference on the server in the form path: (relPath). Example: path:$doc.getURL('reset') produces target address http://server.domain.com/xwiki/bin/reset/Space/Page where /xwiki/bin/reset/Space/Page is produced by $doc.getURL('reset').
      • path: A required string identifying the resource as a relative path.
      • relPath: A required string containing the relative path of the resource on the server that shall be linked.
    • UNC (Windows Explorer) reference in the form unc: (path). The link is rendered as a file:// link. Examples: unc:C:\Windows\, unc:\\myserver\path\img.png, unc:home/user/somefile
      • unc: A required string identifying the resource as a UNC (Windows Explorer) path.
      • path: A required string containing the local path of resource accessible by the user. Examples: C:\Windows\, \\myserver\path\img.png, home/user/somefile
  • parameters: An optional list of space-separated parameters passed to the link. Example: queryString="mydata1=5&mydata2=Hello" anchor="HTableOfContents" rel="__blank"
    • queryString: An optional query string for specifying parameters that will be appended to the link target address and used in the rendered URL. Example: url:http://domain.com/path||queryString="mydata1=5&mydata2=Hello" produces target address http://domain.com/path?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: url:http://domain.com/path||anchor="HTableOfContents" produces target address http://domain.com/path#HTableOfContents
    • rel: An optional parameter that allows to open link target in new window. Example: rel="__blank"

Tables

Failed to execute the [include] macro. Click on this message for details.

Images

2.1 Images

FeatureXWiki Syntax 2.1Result
Image from attachment on current pageimage:img.pngimg.png
Image from attachment on another pageimage:Space.Page@img.pngimg.png
Image with parameters[[image:img.png||width="25" height="25"]]img.png
Images located at URLimage:http://some/url/img.pngimg.png
Prepackaged Iconsimage:icon:acceptaccept

XWiki Syntax 2.1 Image Specification

The part in ( ) is required, while the parts in { } are optional.

The full format of an image is either image: (reference) or [[image: (reference) {||parameters}]]

  • 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 protocol://path/imageName. Example: http://domain.org/path/img.png
    • Attachment reference in the form {{{wikiName:} space.} page@} (imageName)
      • wikiName: An optional string containing the name of a virtual wiki. The image reference will point to an image attached to a page inside that virtual wiki. Example: mywiki
      • space: An optional wiki Space name. If no space is specified the current space is used. Example: Main
      • page: An optional string containing the name of the wiki page to which the referenced image is attached. Example: WebHome
      • imageName: A required string containing the name of the image attached to a page as it is stored in the wiki.
    • Icon 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 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==
  • 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 on w3.org.
    • 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!)

Advanced

Verbatim

Failed to execute the [include] macro. Click on this message for details.

Quotations

Failed to execute the [include] macro. Click on this message for details.

Groups

Failed to execute the [include] macro. Click on this message for details.

Escapes

Failed to execute the [include] macro. Click on this message for details.

Parameters

Failed to execute the [include] macro. Click on this message for details.

Programming

Macros

Failed to execute the [include] macro. Click on this message for details.

HTML

Failed to execute the [include] macro. Click on this message for details.

Scripts

Failed to execute the [include] macro. Click on this message for details.
Tags:
Created by Ricardo Rodríguez Fernández on 2013/11/14 17:41
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 7.3 - Documentation