User Tools

Site Tools


en:wiki:syntax

Formatting Syntax

DokuWiki supports a simple markup language designed to make the data files as readable as possible. This page lists all the syntax you can use when editing pages. Simply view the source of this page by clicking ‘Edit this page’. If you want to try something out, just use the playground page at. The simpler markup is also easily accessible via quick buttons as well.

Basic Text Formatting

DokuWiki supports bold, italic, underlined and monospaced text. Of course, you can combine all of these.

DokuWiki supports **bold**, //italics//, __underlined__ and ''monospaced'' text.
Of course you can **__//''combine''//__** all of these.

Note that the formatting markers must directly enclose the text, so ** bold ** with spaces inside the markers will not be formatted.

You can use subscript and superscriptas well.

You can use <sub>subscript</sub> and <sup>superscript</sup>, too.

You can mark something as deleted as well.

You can mark something as <del>deleted</del> as well.

Paragraphs are created from blank lines. If you want to force a newline without creating a new paragraph, you can use two backslashes followed by a space or the end of the line.

This is some text with some line breaks
Note that the two backslashes are only recognised at the end of a line
or when followed by
a space \\this happens without it.

This is some text with some line breaks\\ Note that the
two backslashes are only recognised at the end of a line\\
or followed by\\ a whitespace \\this happens without it.

You should only use forced line breaks if absolutely necessary.

DokuWiki supports several ways of creating links.

External

External links are recognised automatically: http://www.google.com or simply www.google.com – You can also set the link text: This Link points to google. Email addresses like this one: andi@splitbrain.org are recognised, too.

DokuWiki supports multiple ways of creating links. External links are recognised
automatically: http://www.google.com or simply www.google.com – You can set
the link text as well: [[http://www.google.com|This The link points to google]]. Email
addresses like this one: <[email protected]> are recognised as well.

Internal

Internal links are created using square brackets. You can either simply provide a pagename or use an additional link text.

Internal links are created using square brackets. You can either simply provide
a [[de:wiki:pagename]] or use an additional [[de:wiki:pagename|link text]].

Wiki page names are automatically converted to lower case; special characters are not permitted.

You can use namespaces by including a colon in the page name.

You can use [[some:namespaces]] by including a colon in the page name.

For details about namespaces, see namespaces .

It is also possible to link to a specific section. Simply add the section name after a hash symbol, as is standard in HTML. This links to this section.

This links to [[de:wiki:syntax#internal|this section]].

Notes:

  • Links to existing pages are displayed in a different style from nonexisting ones.
  • DokuWiki does not use CamelCase to automatically create links by default, but this behaviour can be enabled in the config file. Tip: If ‘DokuWiki’ is a link, then it is enabled.
  • When a section’s heading is changed, its bookmark changes as well. So do not rely too heavily on section linking.

Interwiki

DokuWiki supports Interwiki links. These are quick links to other wikis. For example, this is a link to Wikipedia’s page about wikis: Wiki .

DokuWiki supports [[doku>Interwiki]] links. These are quick links to other wikis.
For example, this is a link to Wikipedia’s page about wikis: [[wp>Wiki]] .

Windows shares

Windows shares such as this are recognised as well. Please note that these are only useful in a homogeneous user group such as a corporate Intranet .

Windows shares such as [[\\server\share|this]] are recognised as well.

Notes:

  • For security reasons, direct browsing of Windows shares only works in Microsoft Internet Explorer by default (and only in the ‘local zone’).
  • For Mozilla and Firefox, this can be enabled via various workarounds mentioned in the Mozilla Knowledge Base. However, a JavaScript warning will still appear when attempting to open a Windows share. To remove this warning (for all users), add the following line to conf/lang/en/lang.php (more details at localisation):
    conf/lang/en/lang.php
    <?php
    /**
     * Customization of the english language file
     * Copy only the strings that needs to be modified
     */
    $lang['js']['nosmblinks'] = '';

You can also use an image to link to another internal or external page by combining the syntax for links and images (see below) as follows:

[[http://php.net|{{wiki:dokuwiki-128.png}}]]

Please note: Image formatting is the only formatting syntax accepted in link names.

The entire image and link syntax is supported (including image resizing, internal and external images and URLs, and interwiki links).

Footnotes

You can add footnotes 1) by using double parentheses.

You can add footnotes ((This is a footnote)) by using double parentheses.

Sectioning

You can use up to five different levels of headings to structure your content. If you have more than three headings, a table of contents is generated automatically — this can be disabled by including the string ~~NOTOC~~ in the document.

Heading Level 3

Heading Level 4

Heading Level 5

Heading Level 3

Heading Level 4

Heading Level 5

By using four or more dashes, you can create a horizontal line:


Media Files

You can include external and internal images, videos and audio files using curly brackets. You can optionally specify their size.

Actual size:

Resize to a specified width:

Resize to specified width and height (if the aspect ratio of the specified width and height does not match that of the image, it will be cropped to the new ratio before resizing):

Resized external image:          

Actual size:                       {{wiki:dokuwiki-128.png }} 
Resize to specified width:           {{wiki:dokuwiki-128.png?50 }} 
Resize to specified width and height: {{wiki:dokuwiki-128.png?200x50}} 
Resized external image:           {{https://www.php.net/images/php.gif?200x50}}

You can choose the alignment by using left or right whitespace.

You can also set the alignment explicitly using a ?left, ?right or ?center parameter. This takes precedence over the whitespace alignment mentioned above and can be combined with a size. Of course, you can add a title (displayed as a tooltip by most browsers) as well.

This is the caption

{{ wiki:dokuwiki-128.png |This is the caption}}

To link an image to another page, see Image Links above.

Supported Media Formats

DokuWiki can embed the following media formats directly.

Image gif, jpg, png
Video webm, ogv, mp4
Audio ogg, mp3, wav
Flash swf

If you specify a filename that is not a supported media format, it will be displayed as a link instead.

By adding ?linkonly you provide a link to the media without displaying it inline

dokuwiki-128.png

dokuwiki-128.png This is just a link to the image.

Fallback Formats

Unfortunately, not all browsers support all video and audio formats. To minimise this issue, you can upload your file in different formats to ensure maximum browser compatibility.

For example, consider this embedded MP4 video:

{{de:wiki:video.mp4|A funny video}}

When you upload a video.webm and video.ogv alongside the referenced video.mp4, DokuWiki will automatically add them as alternatives so that one of the three files is recognised by your browser.

Additionally, DokuWiki supports a ‘poster’ image, which will be displayed before the video starts. This image must have the same filename as the video and be either a JPG or PNG file. In the example above, a video.jpg file would work.

Lists

DokuWiki supports ordered and unordered lists. To create a list item, indent your text by two spaces and use a * for unordered lists or a - for ordered lists.

  • This is a list
  • The second item
    • You can have different levels
  • Another item
  1. The same list, but ordered
  2. Another item
    1. Just use indentation for deeper levels
  3. That’s it
  * This is a list
  * The second item
    * You may have different levels
  * Another item

  - The same list but ordered
  - Another item
    - Just use indention for deeper levels
  - That's it

Also have a look at the FAQ on list items.

-to-text conversions

DokuWiki can convert certain pre-defined characters or strings into images, other text or HTML.

The text-to-image conversion is mainly used for smileys. The text-to-HTML conversion is used for typographical replacements, but can be configured to use other HTML as well.

Text-to-Image Conversions

DokuWiki converts commonly used emoticon s into their graphical equivalents. These Smileys and other images can be configured and extended. Here is an overview of the smileys included in DokuWiki:

  • 8-) 8-)
  • 8-O 8-O
  • :-( :-(
  • :-) :-)
  • =) = )
  • :-/ :-/
  • :-\ :-\
  • :-? :-?
  • :-D :-D
  • :-P :-P
  • :-O :-O
  • :-X :-X
  • :-| :-|
  • ;-) ;-)
  • ^_^ ^_^
  • m( m(
  • :?: :?:
  • :!: :!:
  • LOL LOL
  • FIXME FIXME
  • DELETEME DELETEME

Text to HTML Conversions

Typography: dokuwiki can convert simple text characters to their typographically correct entities. Here is an example of recognised characters.

→ ← ↔⇒ ⇐ ⇔ » « – — 640×480 © ™ ® “He thought 'It's a man's world'…”

-> <- <-> => <= <=> >> << -- --- 640x480 (c) (tm) (r)
"He thought 'It's a man's world'..."

The same can be done to produce any kind of HTML; it simply needs to be added to the pattern file.

There are three exceptions that do not originate from that pattern file: the multiplication entity (640×480), ‘single’ and “double quotes”. These can be disabled via a config option.

Quoting

Sometimes you want to mark text to show that it is a reply or comment. You can use the following syntax:

I think we should do it

> No we shouldn't

>> Well, I say we should

> Really?

>> Yes!

>>> Then lets do it!

I think we should do it

No, we shouldn’t
Well, I say we should
Really?
Yes!
Then let’s do it!

Tables

DokuWiki supports a simple syntax for creating tables.

Heading 1 Heading 2 Heading 3
Row 1 Col 1 Row 1 Col 2 Row 1 Col 3
Row 2 Col 1 some colspan (note the double pipe) Row 3 Col 1 Row 3 Col 2 Row 3 Col 3

Table rows must begin and end with a | for normal rows or a ^ for headers.

^ Heading 1      ^ Heading 2       ^ Heading 3          ^
| Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
| Row 2 Col 1    | some colspan (note the double pipe) || 
| Row 3 Col 1    | Row 3 Col 2     | Row 3 Col 3        |

To connect cells horizontally, simply leave the next cell completely empty, as shown above. Make sure you always use the same number of cell separators!

Vertical table headers are also possible.

Heading 1 Heading 2
Heading 3 Row 1 Col 2 Row 1 Col 3
Heading 4 no colspan this time
Heading 5 Row 2 Col 2 Row 2, Column 3

As you can see, it is the cell separator preceding a cell that determines the formatting:

|              ^ Heading 1            ^ Heading 2          ^
^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
^ Heading 4    | no colspan this time |                    |
^ Heading 5    | Row 2 Col 2          | Row 2, Column 3        |

You can create rowspans (vertically connected cells) by adding ::: into the cells below the one to which they should be connected.

Heading 1 Heading 2 Heading 3
Row 1 Col 1 this cell spans vertically Row 1 Col 3
Row 2 Col 1 Row 2 Col 3
Row 3 Col 1 Row 2 Col 3

Apart from the rowspan syntax, these cells should not contain anything else.

^ Heading 1      ^ Heading 2                  ^ Heading 3          ^
| Row 1 Col 1    | this cell spans vertically | Row 1 Col 3        |
| Row 2 Col 1    | :::                        | Row 2 Col 3        |
| Row 3 Col 1    | :::                        | Row 2 Col 3        |

You can also align the table contents. Simply add at least two spaces at the opposite end of your text: add two spaces on the left to align to the right, two spaces on the right to align to the left, and at least two spaces at both ends for centred text.

Table with alignment
right centre left
left right centre
xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx

This is how it looks in the source:

^           Table with alignment           ^^^
|         right|    centre    |left          |
|left          |         right|    centre    |
| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |

Note: Vertical alignment is not supported.

No Formatting

If you need to display text exactly as it is typed (without any formatting), enclose the area either with <nowiki> tags or, even more simply, with double per cent signs %%.

This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it. The same applies to //__this__ text// with a smiley ;-).

<nowiki>
This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it.
</nowiki>
The same applies to %%//__this__ text// with a smiley ;-)%%.

Code blocks

You can include code blocks in your documents either by indenting them by at least two spaces (as used in the previous examples) or by using the tags <code> or <file>.

This is text is indented by two spaces.
This is preformatted code all spaces are preserved: like              <-this
This is pretty much the same, but you could use it to show that you quoted a file.

These blocks were created from this source:

  This text is indented by two spaces.
<code>
This is preformatted code all spaces are preserved: like              <-this
</code>
<file>
This is pretty much the same, but you could use it to show that you quoted a file.
</file>

Syntax Highlighting

dokuwiki can highlight source code, making it easier to read. It uses the GeSHi Generic Syntax Highlighter — so any language supported by GeSHi is supported. The syntax uses the same code and file blocks described in the previous section, but this time the name of the language syntax to be highlighted is included inside the tag, e.g. <code java> or <file java>.

/**
 * The HelloWorldApp class implements an application that
 * simply displays "Hello World!" to the standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); //Display the string.
    }
}

The following language strings are currently recognized: 4cs 6502acme 6502kickass 6502tasm 68000devpac abap actionscript3 actionscript ada aimms algol68 apache applescript apt_sources arm asm asp asymptote autoconf autohotkey autoit avisynth awk bascomavr bash basic4gl batch bf biblatex bibtex blitzbasic bnf boo caddcl cadlisp ceylon cfdg cfm chaiscript chapel cil c_loadrunner clojure c_mac cmake cobol coffeescript c cpp cpp-qt cpp-winapi csharp css cuesheet c_winapi dart dcl dcpu16 dcs delphi diff div dos dot d ecmascript eiffel email epc e erlang euphoria ezt f1 falcon fo fortran freebasic freeswitch fsharp gambas gdb genero genie gettext glsl gml gnuplot go groovy gwbasic haskell haxe hicest hq9plus html html4strict html5 icon idl ini inno intercal io ispfpanel java5 java javascript jcl j jquery julia kixtart klonec klonecpp kotlin latex lb ldif lisp llvm locobasic logtalk lolcode lotusformulas lotusscript lscript lsl2 lua m68k magiksf make mapbasic mathematica matlab mercury metapost mirc mk-61 mmix modula2 modula3 mpasm mxml mysql nagios netrexx newlisp nginx nimrod nsis oberon2 objc objeck ocaml-brief ocaml octave oobas oorexx oracle11 oracle8 oxygene oz parasail parigp pascal pcre perl6 perl per pf phix php-brief php pic16 pike pixelbender pli plsql postgresql postscript povray powerbuilder powershell proftpd progress prolog properties providex purebasic pycon pys60 python qbasic qml q racket rails rbs rebol reg rexx robots roff rpmspec rsplus ruby rust sas sass scala scheme scilab scl sdlbasic smalltalk smarty spark sparql sql sshconfig standardml stonescript swift systemverilog tclegg tcl teraterm texgraph text thinbasic tsql twig typoscript unicon upc urbi uscript vala vbnet vb vbscript vedit verilog vhdl vim visualfoxpro visualprolog whitespace whois winbatch wolfram xbasic xml xojo xorg_conf xpp yaml z80 zxbasic

There are additional advanced options available for syntax highlighting, such as highlighting lines or adding line numbers.

Downloadable Code Blocks

When you use the <code> or <file> syntax as above, you might want to make the shown code available for download as well. You can do this by specifying a file name after language code like this:

<file php myexample.php>
<?php echo "hello world!"; ?>
</file>
myexample.php
<?php echo "hello world!"; ?>

If you do not want any highlighting but would like a downloadable file, specify a dash (-) as the language code: <code - myfile.foo>.

RSS/ATOM Feed Aggregation

dokuwiki can integrate data from external XML feeds. To parse the XML feeds, SimplePie is used. All formats supported by SimplePie can also be used in DokuWiki. You can customise the rendering using several additional space-separated parameters:

Parameter Description
any number will be used as the maximum number of items to display; defaults to 8
reverse display the most recent items in the feed first
author show item authors’ names
date show item dates
description show the item description. All HTML tags will be stripped
nosort do not sort the items in the feed
n[dhm] refresh period, where d=days, h=hours, m=minutes. (e.g. 12h = 12 hours).

The refresh period defaults to 4 hours. Any value below 10 minutes will be treated as 10 minutes. dokuwiki will generally attempt to serve a cached version of a page; obviously, this is inappropriate when the page contains dynamic external content. The parameter instructs dokuwiki to re-render the page if it is more than refresh period has elapsed since the page was last rendered.

By default, the feed will be sorted by date, with the newest items first. You can sort it with the oldest items first using the reverse parameter, or display the feed as it is with nosort.

Example:

{{rss>http://slashdot.org/index.rss 5 author date 1h }}

Control Macros

Some syntax affects how DokuWiki renders a page without generating any output itself. The following control macros are available:

Macro Description
~~NOTOC~~ If this macro is found on the page, no table of contents will be created
~~NOCACHE~~ DokuWiki caches all output by default. Sometimes this may not be desired (e.g. when the <php> syntax above is used); adding this macro will force DokuWiki to re-render a page on every call

Syntax Plugins

DokuWiki’s syntax can be extended by plugins. How the installed plugins are used is described on their respective description pages. The following syntax plugins are available in this particular DokuWiki installation:


1) This is a footnote
en/wiki/syntax.txt · Last modified: by domele