XWiki Syntax Guide
XWiki Syntax 2.0
XWiki Syntax 2.0: All
General
Introduction
2.0 Introduction
Starting with XWiki 1.7 we've introduced a new wiki syntax. We've named the old syntax the XWiki Syntax 1.0 and the new syntax was logically called the XWiki Syntax 2.0. The main reasons for introducing the new syntax were:
- Fix the limitations and ambiguities of the XWiki 1.0 syntax (which was inspired by both Radeox - the underlying rendering engine - and TWiki).
- Not optimal symbols. For example the symbol for bold was single stars. This was causing trouble when users were entering text containing stars since that text was mistakenly considered to be bold when it wasn't. Hence we've rationalized the syntax by using at least double characters everywhere.
- Ambiguities. For example there was an ambiguity between a bold item starting a line and a bullet list. Resolving the ambiguities was required in order to rewrite the WYSIWYG editor so that it could be deterministic.
- Be closer to the Creole 1.0 syntax which is becoming a standard for wiki syntax. In addition the Creole community has taken the time to analyze all the existing wiki syntaxes before deciding on symbols. The choices made are thus very good.
In addition to these XWiki-specific syntaxes we've also changed our underlying rendering engine (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
2.0 General Remarks
XWiki Syntax 2.0 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.0 |
---|---|---|
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
Не удалось выполнить макрос [include]. Причина: [Cannot find section [H2.0OtherSyntaxes] in document [xwiki:XWiki.XWikiSyntaxOtherSyntaxes]]. Нажмите на это сообщение для получения подробной информации.
Editing
Paragraphs
2.0 Paragraphs
Paragraphs are text elements separated by 2 or more new lines.
Feature | XWiki Syntax 2.0 | 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 |
Заголовки
2.0 Headings
Функциональность | Синтаксис XWiki 2.0 | Результат |
---|---|---|
Стандартные заголовки | = уровень 1 = == уровень 2 == === уровень 3 === ==== уровень 4 ==== ===== уровень 5 ===== ====== уровень 6 ====== | уровень 1уровень 2уровень 3уровень 4уровень 5уровень 6 |
Параметризованные заголовки | (% style="color:blue" %)= заголовок= | заголовок |
Заголовки с синтаксисом XWiki | === Заголовок с **полужирным** === | Заголовок с полужирным |
Text Formatting
2.0 Text Formatting
Feature | XWiki Syntax 2.0 | 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.0 | Result |
---|---|---|
Simple horizontal line | ---- | |
Parametrized horizontal line | (% style="border-color:blue" %) ---- |
Lists
2.0 Lists
Feature | XWiki Syntax 2.0 | 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 |
|
Списки определений
2.0 Definition Lists
Функциональность | Синтаксис XWiki 2.0 | Результат |
---|---|---|
Стандартное определение | ; термин : определение |
|
Вложенные определения | ; термин 1 : определение 1 :; термин 2 :: определение 2 |
|
Параметризированное определение | (% style="color:blue" %) ; термин : определение |
|
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.0 | Result |
---|---|---|
Line break | Line\\New line | Line New line |
New line | Line New line | Line New line |
Links
2.0 Links
Feature | XWiki Syntax 2.0 | Result |
---|---|---|
Link to a page in the current Space | [[WebHome]] | XWiki |
Link with a label | [[label>>WebHome]] | label |
Link with XWiki Syntax in the label | [[**bold label**>>WebHome]] | bold label |
Link to a page with the space specified | [[Main.WebHome]] | Main |
Link to a subwiki | [[subwiki:Main.WebHome]] | Main |
Link that opens in a new window | [[label>>WebHome||target="_blank"]] | label |
Link to a URL directly in the text | This is a URL: https://xwiki.org | This 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 | [[john@smith.net>>mailto:john@smith.net]] | john@smith.net |
Image Link | [[image:Space2.Page2@img.png>>Space1.Page1]] | ![]() |
Image Link with image parameters | [[[[image:Space2.Page2@img.png||width="26" height="26"]]>>Space1.Page1]] | ![]() |
Link to an attachment on the current page | [[text>>attach:img.png]] | |
Link to an attachment in a different page | [[text>>attach:Space.Page@img.png]] | |
Link to an Anchor in a page | [[label>>Space.Page#anchor]] | label |
Link to a Heading in a page | [[label>>Space.Page#HMyheading]] | label |
Link to an Anchor in the current page | [[label>>#anchor]] | label |
XWiki Syntax 2.0 Link Specification
The full format of a link is [label>>] (resource) [@interWikiAlias] [||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: The full link reference using the following syntax: (reference) [?queryString] [#anchor]
- reference: The link reference in one of the following forms:
- URL: Any URL in the form of protocol://path. Examples: http://xwiki.org, https://svn.xwiki.org/
- 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
- 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 page that holds the attachment, see "Wiki page" 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"
- 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 and images. Example: HTableOfContents
- reference: The link reference in one of the following forms:
- 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
- parameters: An optional list of parameters passed to the link. Example: target="_blank" (open in new window)
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.0.
Feature | XWiki Syntax 2.0 | 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.0 Images
Feature | XWiki Syntax 2.0 | Result |
---|---|---|
Image from attachment on current page | image:img.png | ![]() |
Image from attachment on another page | image:Space.Page@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 | ![]() |
XWiki Syntax 2.0 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.0 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 http://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 wiki. The image reference will point to an image attached to a page inside that 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.
- 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.
- 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.0 | 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.0 | 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.0 | 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 |
Экранирование
2.0 Escapes
Позволяет экранировать XWiki-разметку.
Функциональность | Синтаксис XWiki 2.0 | Результат |
---|---|---|
Экранирование символа | Это не ~[~[ссылка~]~] | Это не [[ссылка]] |
Экранирование длинного текста (см. также "Verbatim") | {{{ какой-нибудь **длинный** текст //без// форматирования}}} | какой-нибудь **длинный** текст //без// форматирования |
Parameters
2.0 Parameters
With XWiki Syntax 2.0 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.0 | 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.0, 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.0 | 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
ID | Название | Категории | Описание | Видимость |
---|---|---|---|---|
activity | Активность | Notifications | Макрос Активность предоставляет информацию о последней активности пользователей XWiki. Перечисляет события создания, редактирования и удаления страниц, а также добавления комментариев, вложений и аннотаций. | Текущая Вики |
async | Асинхронный макрос | Содержимое | Выполнить асинхронно и / или кэшировать содержимое макроса. | Глобально |
attachmentGalleryPicker | Средство выбора вложений | Разработка | Средство выбора вложений на основе сетки. | Глобально |
attachmentSelector | Выбор вложенных файлов | Разработка | Элемент управления свойствами объекта текущей страницы, в которой содержатся имена вложенных файлов текущей (или целевой) страницы. Позволяет загружать новые вложения и удалять существующие с целевой страницы. Если целевая страница не указана, то используется текущая. Свойства объекта сохраняются только для текущей страницы. | Текущая Вики |
box | окно | Форматирование | Показать блок вокруг. | Глобально |
cache | Кэш | Разработка | Кэширует контент. | Глобально |
chart | График | Содержимое | Показывает график полученный из различных источников данных | Глобально |
children | Children | Навигация | Displays a tree of children pages of the current page | Текущая Вики |
code | Код | Форматирование | Подсвеченные части кода различных языков программирования | Глобально |
comment | Комментарий | Разработка | Позволяет вставлять комментарии в контент. Этот макрос ничего не выводит в текст страницы. | Глобально |
container | Контейнер | Макет | Макрос для объединения нескольких групп и добавления декораций, как на выходе. | Глобально |
content | Содержимое | Содержимое | Позволяет создавать контент в любой вики-разметке | Глобально |
context | Контекст | Разработка | Исполняет содержимое в контексте переданных документов | Глобально |
dashboard | Панель управления | Макет | Макрос для заполнения главной панели гаджетами. | Глобально |
display | Показать страницу | Содержимое | Показать другие страницы в текущей. | Глобально |
displayIcon | Icon | Содержимое | Display an icon. | Глобально |
documents | Страницы | Содержимое | Показывает список страниц в таблице Livetable | Текущая Вики |
documentTree | Дерево страниц | Навигация | Отображает дерево страниц XWiki. | Текущая Вики |
error | Сообщение об ошибке | Форматирование | Показать сообщение об ошибке. | Глобально |
example | Example | Форматирование | Shows an example and its source code. | Текущая Вики |
footnote | Сноска | Содержимое | Генерирует сноску внизу страницы. | Глобально |
gallery | Галерея | Макет | Показать изображения, найденные в указанном контенте в режиме слайд-шоу. | Глобально |
groovy | Groovy | Разработка | Выполнить groovy-скрипт. | Глобально |
html | HTML | Разработка | Вставить HTML или XHTML-код на страницу. | Глобально |
iconPicker | Icon Picker | Разработка | Выберите значок в наборе значков XWiki. | Текущая Вики |
id | ID | Навигация | Позволяет положить ссылку/расположение на страницу. Например, в HTML это называется якорями. Это позволяет указать расположение, например, в ссылках. | Глобально |
include | Включить | Содержимое | Включить другие страницы в текущую. | Глобально |
info | Информационное сообщение | Форматирование | Показать информационное сообщение. | Глобально |
liveData | Живые данные | Содержимое | Отображает динамические списки данных. | Глобально |
mention | Упоминание Пользователя | Notifications | Вставьте упоминание пользователя. | Текущая Вики |
menu | Меню | Навигация | Отображает меню, созданное с использованием простого синтаксиса вики (вложенные списки и ссылки). | Глобально |
messageSender | Отправитель сообщения | Social | Элемент управления, который позволяет пользователям вводить сообщения, которые обрабатываются модулем Лента активности(MessageStream). | Текущая Вики |
notifications | Уведомления | Notifications | Отображать уведомления о событиях, произошедших в вики. | Текущая Вики |
notificationsApplicationsPreferences | Настройки Приложений Уведомлений | Notifications | Отображение предпочтений текущего пользователя в отношении приложений уведомлений. | Текущая Вики |
notificationsAutoWatchPreferences | Настройки уведомлений Автонаблюдения | Notifications | Отображение предпочтений текущего пользователя в отношении Автонаблюдения за страницами. | Текущая Вики |
notificationsCustomFiltersPreferences | Notifications Custom Filters Preferences | Notifications | Display the preferences of the given user about custom notification filters. | Текущая Вики |
notificationsEmailPreferences | Notifications Email Preferences | Notifications | Display the preferences of the current user about notification emails. | Текущая Вики |
notificationsFiltersPreferences | Notifications Filters Preferences (deprecated) | Notifications | Display the preferences of the current user about notification filters. This macro is now deprecated in favor of Custom Notifications Filters Preferences or System Notifications Filters Preferences. | Текущая Вики |
notificationsSystemFiltersPreferences | Notifications System Filters Preferences | Notifications | Display the preferences of the given user about system notification filters. | Текущая Вики |
office | Просмотрщик документов Office | Содержимое | Просмотреть вложения Office(doc, ppt, xls, odt, odp, ods и т.д.) внутри wiki-страниц, без скачивания и импортирования. | Глобально |
pdftoc | PDF Table of Contents | Внутренний | Generates the table of contents for the PDF export. | Глобально |
pdfviewer | PDF Viewer | Содержимое | PDF Viewer на основе Mozilla pdf.js | Текущая Вики |
putFootnotes | Вставить сноски | Содержимое | Отображать все сноски на странице. Если они отсутствуют, по умолчанию все сноски отображаются в конце страницы. | Глобально |
python | Python | Разработка | Выполнить python-скрипт. | Глобально |
script | Скрипт | Разработка | Исполнить скрипт в соответствующем интерпретаторе языка. | Глобально |
showhide | showhide | content | Show Hide Macro | Текущая Вики |
success | Сообщение об успешном событии | Форматирование | Выводит сообщение об успешном завершении. | Глобально |
tagcloud | Облако тегов | Содержимое | Отображать облако тегов для этой вики или указанного раздела, если имеется. | Текущая Вики |
template | Шаблон | Разработка | Вставить шаблон. | Глобально |
toc | Содержание | Навигация | Генерирует "Содержание". | Глобально |
translation | Перевод | Содержимое | Отобразить перевод сообщения. | Глобально |
tree | Дерево | Навигация | Отображает древовидную иерархию, определенную содержимым макроса или параметром источника. | Текущая Вики |
uiextension | Расширение UI | Разработка | Вставить расширение UI. | Глобально |
uiextensions | Расширения UI | Разработка | Вставить UI расширения. | Глобально |
useravatar | Аватар пользователя | Содержимое | Разрешить показывать аватар для определенного пользователя. | Глобально |
velocity | Velocity | Разработка | Исполняет Velocity-скрипт. | Глобально |
warning | Предупреждение | Форматирование | Показывает предупреждение. | Глобально |
wikimacrocontent | WikiMacro Content | Разработка | Display editable content of a wikimacro. | Глобально |
wikimacroparameter | WikiMacro Parameter | Разработка | Display editable parameter of a wikimacro. | Глобально |
wikis | Вики | Навигация | Список всех вики | Глобально |
workspaces | Рабочие пространства (устаревшее) | Устаревшие | Устаревший макрос, который не следует использовать здесь из соображений совместимости. Пожалуйста, используйте вместо этого макрос "Вики". | Глобально |
HTML
2.0 HTML
XWiki Syntax 2.0 | Result |
---|---|
{{html}}<abbr title="HyperText Markup Language">HTML</abbr>{{/html}} | HTML |
Scripts
2.0 Scripts
Feature | XWiki Syntax 2.0 |
---|---|
Velocity script | {{velocity}} #set ($var = "whatever") {{/velocity}} |
Groovy script | {{groovy}} def var = "whatever" {{/groovy}} |