xref: /dokuwiki/data/pages/wiki/syntax.txt (revision c3a14f677ee1ae0cdba278e7ba21602e6cabba18)
1====== Formatting Syntax ======
2
3[[doku>DokuWiki]] supports some simple markup language, which tries to make the datafiles to be as readable as possible. This page contains all possible syntax you may use when editing the pages. Simply have a look at the source of this page by pressing "Edit this page". If you want to try something, just use the [[playground:playground|playground]] page. The simpler markup is easily accessible via [[doku>toolbar|quickbuttons]], too.
4
5===== Basic Text Formatting =====
6
7DokuWiki supports **bold**, //italic//, __underlined__ and ''monospaced'' texts. Of course you can **__//''combine''//__** all these.
8
9  DokuWiki supports **bold**, //italic//, __underlined__ and ''monospaced'' texts.
10  Of course you can **__//''combine''//__** all these.
11
12Note that the formatting markers have to directly enclose the text, so ''%%** bold **%%'' with spaces inside the markers will not be formatted.
13
14You can use <sub>subscript</sub> and <sup>superscript</sup>, too.
15
16  You can use <sub>subscript</sub> and <sup>superscript</sup>, too.
17
18You can mark something as <del>deleted</del> as well.
19
20  You can mark something as <del>deleted</del> as well.
21
22**Paragraphs** are created from blank lines. If you want to **force a newline** without a paragraph, you can use two backslashes followed by a whitespace or the end of line.
23
24This is some text with some linebreaks\\ Note that the
25two backslashes are only recognized at the end of a line\\
26or followed by\\ a whitespace \\this happens without it.
27
28  This is some text with some linebreaks\\ Note that the
29  two backslashes are only recognized at the end of a line\\
30  or followed by\\ a whitespace \\this happens without it.
31
32You should use forced newlines only if really needed.
33
34===== Links =====
35
36DokuWiki supports multiple ways of creating links.
37
38==== External ====
39
40External links are recognized automagically: http://www.google.com or simply www.google.com - You can set the link text as well: [[http://www.google.com|This Link points to google]]. Email addresses like this one: <andi@splitbrain.org> are recognized, too.
41
42  DokuWiki supports multiple ways of creating links. External links are recognized
43  automagically: http://www.google.com or simply www.google.com - You can set
44  link text as well: [[http://www.google.com|This Link points to google]]. Email
45  addresses like this one: <andi@splitbrain.org> are recognized, too.
46
47==== Internal ====
48
49Internal links are created by using square brackets. You can either just give a [[pagename]] or use an additional [[pagename|link text]].
50
51  Internal links are created by using square brackets. You can either just give
52  a [[pagename]] or use an additional [[pagename|link text]].
53
54[[doku>pagename|Wiki pagenames]] are converted to lowercase automatically, special characters are not allowed.
55
56You can use [[some:namespaces]] by using a colon in the pagename.
57
58  You can use [[some:namespaces]] by using a colon in the pagename.
59
60For details about namespaces see [[doku>namespaces]].
61
62Linking to a specific section is possible, too. Just add the section name behind a hash character as known from HTML. This links to [[syntax#internal|this Section]].
63
64  This links to [[syntax#internal|this Section]].
65
66Notes:
67
68  * Links to [[syntax|existing pages]] are shown in a different style from [[nonexisting]] ones.
69  * DokuWiki does not use [[wp>CamelCase]] to automatically create links by default, but this behavior can be enabled in the [[doku>config]] file. Hint: If DokuWiki is a link, then it's enabled.
70  * When a section's heading is changed, its bookmark changes, too. So don't rely on section linking too much.
71
72==== Interwiki ====
73
74DokuWiki 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]].
75
76  DokuWiki supports [[doku>Interwiki]] links. These are quick links to other Wikis.
77  For example this is a link to Wikipedia's page about Wikis: [[wp>Wiki]].
78
79==== Windows Shares ====
80
81Windows shares like [[\\server\share|this]] are recognized, too. Please note that these only make sense in a homogeneous user group like a corporate [[wp>Intranet]].
82
83  Windows Shares like [[\\server\share|this]] are recognized, too.
84
85Notes:
86
87  * For security reasons direct browsing of windows shares only works in Microsoft Internet Explorer per default (and only in the "local zone").
88  * For Mozilla and Firefox it can be enabled through different workaround mentioned in the [[http://kb.mozillazine.org/Links_to_local_pages_do_not_work|Mozilla Knowledge Base]]. However, there will still be a JavaScript warning about trying to open a Windows Share. To remove this warning (for all users), put the following line in ''conf/lang/en/lang.php'' (more details at [[doku>localization#changing_some_localized_texts_and_strings_in_your_installation|localization]]): <code - conf/lang/en/lang.php>
89<?php
90/**
91 * Customization of the english language file
92 * Copy only the strings that needs to be modified
93 */
94$lang['js']['nosmblinks'] = '';
95</code>
96
97==== Image Links ====
98
99You can also use an image to link to another internal or external page by combining the syntax for links and [[#images_and_other_files|images]] (see below) like this:
100
101  [[http://php.net|{{wiki:dokuwiki-128.png}}]]
102
103[[http://php.net|{{wiki:dokuwiki-128.png}}]]
104
105Please note: The image formatting is the only formatting syntax accepted in link names.
106
107The whole [[#images_and_other_files|image]] and [[#links|link]] syntax is supported (including image resizing, internal and external images and URLs and interwiki links).
108
109===== Footnotes =====
110
111You can add footnotes ((This is a footnote)) by using double parentheses.
112
113  You can add footnotes ((This is a footnote)) by using double parentheses.
114
115===== Sectioning =====
116
117You can use up to five different levels of headlines to structure your content. If you have more than three headlines, a table of contents is generated automatically -- this can be disabled by including the string ''<nowiki>~~NOTOC~~</nowiki>'' in the document.
118
119==== Headline Level 3 ====
120=== Headline Level 4 ===
121== Headline Level 5 ==
122
123  ==== Headline Level 3 ====
124  === Headline Level 4 ===
125  == Headline Level 5 ==
126
127By using four or more dashes, you can make a horizontal line:
128
129----
130
131===== Media Files =====
132
133You can include external and internal [[doku>images|images, videos and audio files]] with curly brackets. Optionally you can specify the size of them.
134
135Real size:                        {{wiki:dokuwiki-128.png}}
136
137Resize to given width:            {{wiki:dokuwiki-128.png?50}}
138
139Resize to given width and height((when the aspect ratio of the given width and height doesn't match that of the image, it will be cropped to the new ratio before resizing)): {{wiki:dokuwiki-128.png?200x50}}
140
141Resized external image:           {{https://www.php.net/images/php.gif?200x50}}
142
143  Real size:                        {{wiki:dokuwiki-128.png}}
144  Resize to given width:            {{wiki:dokuwiki-128.png?50}}
145  Resize to given width and height: {{wiki:dokuwiki-128.png?200x50}}
146  Resized external image:           {{https://www.php.net/images/php.gif?200x50}}
147
148
149By using left or right whitespaces you can choose the alignment.
150
151{{ wiki:dokuwiki-128.png}}
152
153{{wiki:dokuwiki-128.png }}
154
155{{ wiki:dokuwiki-128.png }}
156
157  {{ wiki:dokuwiki-128.png}}
158  {{wiki:dokuwiki-128.png }}
159  {{ wiki:dokuwiki-128.png }}
160
161You can also set the alignment explicitly with a ''?left'', ''?right'' or ''?center'' parameter. This takes precedence over the whitespace alignment above and can be combined with a size.
162
163{{wiki:dokuwiki-128.png?100&right}}
164
165  {{wiki:dokuwiki-128.png?100&right}}
166
167Of course, you can add a title (displayed as a tooltip by most browsers), too.
168
169{{ wiki:dokuwiki-128.png |This is the caption}}
170
171  {{ wiki:dokuwiki-128.png |This is the caption}}
172
173For linking an image to another page see [[#Image Links]] above.
174
175==== Supported Media Formats ====
176
177DokuWiki can embed the following media formats directly.
178
179| Image | ''gif'', ''jpg'', ''png''  |
180| Video | ''webm'', ''ogv'', ''mp4'' |
181| Audio | ''ogg'', ''mp3'', ''wav''  |
182| Flash | ''swf''                    |
183
184If you specify a filename that is not a supported media format, then it will be displayed as a link instead.
185
186By adding ''?linkonly'' you provide a link to the media without displaying it inline
187
188  {{wiki:dokuwiki-128.png?linkonly}}
189
190{{wiki:dokuwiki-128.png?linkonly}} This is just a link to the image.
191
192==== Fallback Formats ====
193
194Unfortunately not all browsers understand all video and audio formats. To mitigate the problem, you can upload your file in different formats for maximum browser compatibility.
195
196For example consider this embedded mp4 video:
197
198  {{video.mp4|A funny video}}
199
200When you upload a ''video.webm'' and ''video.ogv'' next to the referenced ''video.mp4'', DokuWiki will automatically add them as alternatives so that one of the three files is understood by your browser.
201
202Additionally DokuWiki supports a "poster" image which will be shown before the video has started. That image needs to 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.
203
204===== Lists =====
205
206Dokuwiki 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 ones.
207
208  * This is a list
209  * The second item
210    * You may have different levels
211  * Another item
212
213  - The same list but ordered
214  - Another item
215    - Just use indention for deeper levels
216  - That's it
217
218<code>
219  * This is a list
220  * The second item
221    * You may have different levels
222  * Another item
223
224  - The same list but ordered
225  - Another item
226    - Just use indention for deeper levels
227  - That's it
228</code>
229
230Also take a look at the [[doku>faq:lists|FAQ on list items]].
231
232===== Text Conversions =====
233
234DokuWiki can convert certain pre-defined characters or strings into images or other text or HTML.
235
236The text to image conversion is mainly done for smileys. And the text to HTML conversion is used for typography replacements, but can be configured to use other HTML as well.
237
238==== Text to Image Conversions ====
239
240DokuWiki converts commonly used [[wp>emoticon]]s to their graphical equivalents. Those [[doku>Smileys]] and other images can be configured and extended. Here is an overview of Smileys included in DokuWiki:
241
242  * 8-) %%  8-)  %%
243  * 8-O %%  8-O  %%
244  * :-( %%  :-(  %%
245  * :-) %%  :-)  %%
246  * =)  %%  =)   %%
247  * :-/ %%  :-/  %%
248  * :-\ %%  :-\  %%
249  * :-? %%  :-?  %%
250  * :-D %%  :-D  %%
251  * :-P %%  :-P  %%
252  * :-O %%  :-O  %%
253  * :-X %%  :-X  %%
254  * :-| %%  :-|  %%
255  * ;-) %%  ;-)  %%
256  * ^_^ %%  ^_^  %%
257  * m(  %%  m(   %%
258  * :?: %%  :?:  %%
259  * :!: %%  :!:  %%
260  * LOL %%  LOL  %%
261  * FIXME %%  FIXME %%
262  * DELETEME %% DELETEME %%
263
264==== Text to HTML Conversions ====
265
266Typography: [[DokuWiki]] can convert simple text characters to their typographically correct entities. Here is an example of recognized characters.
267
268-> <- <-> => <= <=> >> << -- --- 640x480 (c) (tm) (r)
269"He thought 'It's a man's world'..."
270
271<code>
272-> <- <-> => <= <=> >> << -- --- 640x480 (c) (tm) (r)
273"He thought 'It's a man's world'..."
274</code>
275
276The same can be done to produce any kind of HTML, it just needs to be added to the [[doku>entities|pattern file]].
277
278There are three exceptions which do not come from that pattern file: multiplication entity (640x480), 'single' and "double quotes". They can be turned off through a [[doku>config:typography|config option]].
279
280===== Quoting =====
281
282Some times you want to mark some text to show it's a reply or comment. You can use the following syntax:
283
284<code>
285I think we should do it
286
287> No we shouldn't
288
289>> Well, I say we should
290
291> Really?
292
293>> Yes!
294
295>>> Then lets do it!
296</code>
297
298I think we should do it
299
300> No we shouldn't
301
302>> Well, I say we should
303
304> Really?
305
306>> Yes!
307
308>>> Then lets do it!
309
310===== Tables =====
311
312DokuWiki supports a simple syntax to create tables.
313
314^ Heading 1      ^ Heading 2       ^ Heading 3          ^
315| Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
316| Row 2 Col 1    | some colspan (note the double pipe) ||
317| Row 3 Col 1    | Row 3 Col 2     | Row 3 Col 3        |
318
319Table rows have to start and end with a ''|'' for normal rows or a ''^'' for headers.
320
321  ^ Heading 1      ^ Heading 2       ^ Heading 3          ^
322  | Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
323  | Row 2 Col 1    | some colspan (note the double pipe) ||
324  | Row 3 Col 1    | Row 3 Col 2     | Row 3 Col 3        |
325
326To connect cells horizontally, just make the next cell completely empty as shown above. Be sure to have always the same amount of cell separators!
327
328Vertical tableheaders are possible, too.
329
330|              ^ Heading 1            ^ Heading 2          ^
331^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
332^ Heading 4    | no colspan this time |                    |
333^ Heading 5    | Row 2 Col 2          | Row 2 Col 3        |
334
335As you can see, it's the cell separator before a cell which decides about the formatting:
336
337  |              ^ Heading 1            ^ Heading 2          ^
338  ^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
339  ^ Heading 4    | no colspan this time |                    |
340  ^ Heading 5    | Row 2 Col 2          | Row 2 Col 3        |
341
342You can have rowspans (vertically connected cells) by adding ''%%:::%%'' into the cells below the one to which they should connect.
343
344^ Heading 1      ^ Heading 2                  ^ Heading 3          ^
345| Row 1 Col 1    | this cell spans vertically | Row 1 Col 3        |
346| Row 2 Col 1    | :::                        | Row 2 Col 3        |
347| Row 3 Col 1    | :::                        | Row 2 Col 3        |
348
349Apart from the rowspan syntax those cells should not contain anything else.
350
351  ^ Heading 1      ^ Heading 2                  ^ Heading 3          ^
352  | Row 1 Col 1    | this cell spans vertically | Row 1 Col 3        |
353  | Row 2 Col 1    | :::                        | Row 2 Col 3        |
354  | Row 3 Col 1    | :::                        | Row 2 Col 3        |
355
356You can align the table contents, too. Just add at least two whitespaces at the opposite end of your text: Add two spaces on the left to align right, two spaces on the right to align left and two spaces at least at both ends for centered text.
357
358^           Table with alignment           ^^^
359|         right|    center    |left          |
360|left          |         right|    center    |
361| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
362
363This is how it looks in the source:
364
365  ^           Table with alignment           ^^^
366  |         right|    center    |left          |
367  |left          |         right|    center    |
368  | xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
369
370Note: Vertical alignment is not supported.
371
372===== No Formatting =====
373
374If you need to display text exactly like it is typed (without any formatting), enclose the area either with ''%%<nowiki>%%'' tags or even simpler, with double percent signs ''<nowiki>%%</nowiki>''.
375
376<nowiki>
377This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it.
378</nowiki>
379The same is true for %%//__this__ text// with a smiley ;-)%%.
380
381  <nowiki>
382  This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it.
383  </nowiki>
384  The same is true for %%//__this__ text// with a smiley ;-)%%.
385
386===== Code Blocks =====
387
388You can include code blocks into your documents by either indenting them by at least two spaces (like used for the previous examples) or by using the tags ''%%<code>%%'' or ''%%<file>%%''.
389
390  This is text is indented by two spaces.
391
392<code>
393This is preformatted code all spaces are preserved: like              <-this
394</code>
395
396<file>
397This is pretty much the same, but you could use it to show that you quoted a file.
398</file>
399
400Those blocks were created by this source:
401
402    This is text is indented by two spaces.
403
404  <code>
405  This is preformatted code all spaces are preserved: like              <-this
406  </code>
407
408  <file>
409  This is pretty much the same, but you could use it to show that you quoted a file.
410  </file>
411
412==== Syntax Highlighting ====
413
414[[wiki:DokuWiki]] can highlight sourcecode, which makes it easier to read. It uses the [[http://qbnz.com/highlighter/|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. ''<nowiki><code java></nowiki>'' or ''<nowiki><file java></nowiki>''.
415
416<code java>
417/**
418 * The HelloWorldApp class implements an application that
419 * simply displays "Hello World!" to the standard output.
420 */
421class HelloWorldApp {
422    public static void main(String[] args) {
423        System.out.println("Hello World!"); //Display the string.
424    }
425}
426</code>
427
428The 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//
429
430There are additional [[doku>syntax_highlighting|advanced options]] available for syntax highlighting, such as highlighting lines or adding line numbers.
431
432==== Downloadable Code Blocks ====
433
434When 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:
435
436<code>
437<file php myexample.php>
438<?php echo "hello world!"; ?>
439</file>
440</code>
441
442<file php myexample.php>
443<?php echo "hello world!"; ?>
444</file>
445
446If you don't want any highlighting but want a downloadable file, specify a dash (''-'') as the language code: ''%%<code - myfile.foo>%%''.
447
448===== RSS/ATOM Feed Aggregation =====
449[[DokuWiki]] can integrate data from external XML feeds. For parsing the XML feeds, [[http://simplepie.org/|SimplePie]] is used. All formats understood by SimplePie can be used in DokuWiki as well. You can influence the rendering by multiple additional space separated parameters:
450
451^ Parameter  ^ Description ^
452| any number | will be used as maximum number items to show, defaults to 8 |
453| reverse    | display the last items in the feed first |
454| author     | show item authors names |
455| date       | show item dates |
456| description| show the item description. All HTML tags will be stripped |
457| nosort     | do not sort the items in the feed |
458| //n//[dhm] | refresh period, where d=days, h=hours, m=minutes. (e.g. 12h = 12 hours). |
459
460The refresh period defaults to 4 hours. Any value below 10 minutes will be treated as 10 minutes. [[wiki:DokuWiki]] will generally try to supply a cached version of a page, obviously this is inappropriate when the page contains dynamic external content. The parameter tells [[wiki:DokuWiki]] to re-render the page if it is more than //refresh period// since the page was last rendered.
461
462By default the feed will be sorted by date, newest items first. You can sort it by oldest first using the ''reverse'' parameter, or display the feed as is with ''nosort''.
463
464**Example:**
465
466  {{rss>http://slashdot.org/index.rss 5 author date 1h }}
467
468{{rss>http://slashdot.org/index.rss 5 author date 1h }}
469
470
471===== Control Macros =====
472
473Some syntax influences how DokuWiki renders a page without creating any output it self. The following control macros are availble:
474
475^ Macro           ^ Description |
476| %%~~NOTOC~~%%   | If this macro is found on the page, no table of contents will be created |
477| %%~~NOCACHE~~%% | DokuWiki caches all output by default. Sometimes this might not be wanted (eg. when the %%<php>%% syntax above is used), adding this macro will force DokuWiki to rerender a page on every call |
478
479===== Syntax Plugins =====
480
481DokuWiki's syntax can be extended by [[doku>plugins|Plugins]]. How the installed plugins are used is described on their appropriate description pages. The following syntax plugins are available in this particular DokuWiki installation:
482
483~~INFO:syntaxplugins~~
484