Wiki source code of Markdown 1.2 Syntax
Last modified by Vincent Massol on 2026/09/28 14:37
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | The CommonMark Markdown 1.2 syntax follows the [[CommonMark 0.29 specification>>https://spec.commonmark.org/0.29/]] for headings, emphasis, lists, quotes, code, links, images and HTML, and adds the following constructs, which CommonMark doesn't have. | ||
| 2 | |||
| 3 | == Links == | ||
| 4 | |||
| 5 | Use the CommonMark link syntax for URLs and email addresses, and the wiki link syntax for pages of the wiki. In a wiki link, the reference and the parameters use the [[XWiki Syntax 2.1 link format>>doc:Documentation.UserGuide.Features.XWikiSyntax.WebHome||queryString="syntax=2.1§ion=Links"]], and the label and parameters are optional. | ||
| 6 | |||
| 7 | |=Syntax|=Example|=Result | ||
| 8 | |Wiki link|{{code language="none"}}[[Sandbox home|Sandbox.WebHome]]{{/code}}|Link to the ##Sandbox.WebHome## page, labelled "Sandbox home" | ||
| 9 | |Wiki link without label|{{code language="none"}}[[Sandbox.WebHome]]{{/code}}|Link to the page, labelled with its title | ||
| 10 | |Wiki link with parameters|{{code language="none"}}[[Sandbox home|Sandbox.WebHome|queryString="a=b&c=d" anchor="anchor"]]{{/code}}|Link to the page with the ##a=b&c=d## query string and the ##anchor## anchor | ||
| 11 | |URL without brackets|{{code language="none"}}See https://www.xwiki.org{{/code}}|The URL becomes a link | ||
| 12 | |||
| 13 | == Images == | ||
| 14 | |||
| 15 | Use the CommonMark image syntax for image URLs, and the wiki image syntax for images attached to pages of the wiki. The wiki image reference uses the [[XWiki Syntax 2.1 format>>doc:Documentation.UserGuide.Features.XWikiSyntax.WebHome||queryString="syntax=2.1§ion=Links"]], its {{code language="none"}}image:{{/code}} prefix is optional, and the label is the alternative text. | ||
| 16 | |||
| 17 | |=Syntax|=Example|=Result | ||
| 18 | |Wiki image|{{code language="none"}}![[Logo|[email protected]]]{{/code}}|Image ##XWikiLogo.png## attached to ##Sandbox.WebHome## | ||
| 19 | |Wiki image with prefix|{{code language="none"}}![[Logo|image:[email protected]]]{{/code}}|Same image | ||
| 20 | |||
| 21 | == Macros == | ||
| 22 | |||
| 23 | All the XWiki macros are available, with the same syntax inline and on their own lines. The content of a macro that holds wiki content, such as ##info## or ##box##, is written in Markdown. | ||
| 24 | |||
| 25 | |=Syntax|=Example|=Result | ||
| 26 | |Macro without parameters or content|{{code language="none"}}{{toc/}}{{/code}}|Table of contents of the page | ||
| 27 | |Macro with parameters|{{code language="none"}}{{id name="here"/}}{{/code}}|##here## anchor | ||
| 28 | |Macro with parameters and content|{{code language="none"}}{{box title="Note"}}Some *emphasized* text{{/box}}{{/code}}|Box titled "Note", with "emphasized" in italics | ||
| 29 | |Inline macro|{{code language="none"}}Remember: {{info}}meetings are on Monday{{/info}}.{{/code}}|Information message inside the paragraph | ||
| 30 | |||
| 31 | The content of a macro can span several lines: | ||
| 32 | |||
| 33 | {{code language="none"}} | ||
| 34 | {{info}} | ||
| 35 | Meetings take place every *Monday*. | ||
| 36 | {{/info}} | ||
| 37 | {{/code}} | ||
| 38 | |||
| 39 | == Text formatting == | ||
| 40 | |||
| 41 | |=Syntax|=Example|=Result | ||
| 42 | |Strikethrough|{{code language="none"}}Some ~~deleted~~ text{{/code}}|Some text with "deleted" struck through | ||
| 43 | |Superscript|{{code language="none"}}2^10^ is 1024{{/code}}|2^^10^^ is 1024 | ||
| 44 | |Subscript|{{code language="none"}}H~2~O{{/code}}|H,,2,,O | ||
| 45 | |Superscript and subscript with spaces|{{code language="none"}}^with spaces^ and ~with spaces~ text{{/code}}|^^with spaces^^ and ,,with spaces,, text | ||
| 46 | |||
| 47 | == Tables, definition lists and abbreviations == | ||
| 48 | |||
| 49 | |=Syntax|=Example|=Result | ||
| 50 | |Abbreviation|{{code language="none"}}The W3C maintains HTML. | ||
| 51 | |||
| 52 | *[W3C]: World Wide Web Consortium | ||
| 53 | *[HTML]: Hyper Text Markup Language{{/code}}|"W3C" and "HTML" show their definition on mouse over | ||
| 54 | |Definition list|{{code language="none"}}Markdown | ||
| 55 | : A lightweight markup language{{/code}}|Term "Markdown" followed by its definition | ||
| 56 | |Table|{{code language="none"}}| Name | Role | | ||
| 57 | |---|---| | ||
| 58 | | Alice | Admin |{{/code}}|Table with a "Name" and a "Role" header; the spaces around cell content are ignored | ||
| 59 | |||
| 60 | == Groups == | ||
| 61 | |||
| 62 | {{version product="Markdown Syntax" since="8.10.0"}} | ||
| 63 | A group holds several blocks, such as paragraphs and lists, with parameters such as ##class##, ##style## or ##id##, like {{code language="none"}}(% class="box" %)(((...))){{/code}} in XWiki Syntax 2.1. Write it as a ##div## whose attributes are the group parameters, with the opening and the closing tags each alone on their own line, separated from the content by blank lines. The content is written in Markdown, and groups can be nested. For example, this group displays an information box: | ||
| 64 | |||
| 65 | {{code language="none"}} | ||
| 66 | <div class="box infomessage"> | ||
| 67 | |||
| 68 | This is **important**. | ||
| 69 | |||
| 70 | * Read the rules | ||
| 71 | |||
| 72 | </div> | ||
| 73 | {{/code}} | ||
| 74 | |||
| 75 | Any other ##div##, such as {{code language="none"}}<div>text</div>{{/code}} on a single line, is displayed as HTML. | ||
| 76 | {{/version}} |