xref: /dokuwiki/data/pages/wiki/syntax.txt (revision 11e384f72d646266f90cc7ff18c59dea58fd30c7)
1====== Formatting Syntax ======
2
3[[wiki: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 the //Edit this page// button at the top or bottom of the page. If you want to try something, just use the [[playground:playground|playground]] page. The simpler markup is easily accessible via [[doku>wiki:quickbuttons|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
12You can use <sub>subscript</sub> and <sup>superscript</sup>, too.
13
14  You can use <sub>subscript</sub> and <sup>superscript</sup>, too.
15
16You can mark something as <del>deleted</del> as well.
17
18  You can mark something as <del>deleted</del> as well.
19
20**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.
21
22This is some text with some linebreaks\\ Note that the
23two backslashes are only recognized at the end of a line\\
24or followed by\\ a whitespace \\this happens without it.
25
26  This is some text with some linebreaks\\ Note that the
27  two backslashes are only recognized at the end of a line\\
28  or followed by\\ a whitespace \\this happens without it.
29
30You should use forced newlines only if really needed.
31
32===== Links =====
33
34DokuWiki supports multiple ways of creating links.
35
36==== External ====
37
38External links are recognized automagically: http://www.google.com or simply www.google.com - You can set Linknames, too: [[http://www.google.com|This Link points to google]]. Email addresses like this one: <andi@splitbrain.org> are recognized, too.
39
40  DokuWiki supports multiple ways of creating links. External links are recognized
41  automagically: http://www.google.com or simply www.google.com - You can set
42  Linknames, too: [[http://www.google.com|This Link points to google]]. Email
43  addresses like this one: <andi@splitbrain.org> are recognized, too.
44
45==== Internal ====
46
47Internal links are created by using square brackets. You can either just give a [[doku>wiki:pagename]] or use an additional [[doku>wiki:pagename|Title Text]]. Wiki pagenames are converted to lowercase automatically, special characters are not allowed.
48
49  Internal links are created by using square brackets. You can either just give
50  a [[pagename]] or use an additional [[pagename|Title Text]]. Wiki pagenames
51  are converted to lowercase automatically, special chars are not allowed.
52
53You can use [[wiki:namespaces]] by using a colon in the pagename.
54
55  You can use [[wiki:namespaces]] by using a colon in the pagename.
56
57For details about namespaces see [[doku>wiki:namespaces]].
58
59Linking to a specific section is possible, too. Just add the sectionname behind a hash character as known from HTML. This links to [[syntax#internal|this Section]].
60
61  This links to [[syntax#internal|this Section]].
62
63Notes:
64
65  * Links to [[wiki:syntax|existing pages]] are shown in a different style from [[wiki:nonexisting]] ones.
66  * DokuWiki does not use [[wp>CamelCase]] to automatically create links by default, but this behaviour can be enabled in the [[doku>config]] file. Hint: If DokuWiki is a link, then it's enabled.
67  * When a section's heading is changed, its bookmark changes, too. So don't rely on section linking too much.
68
69==== Interwiki ====
70
71DokuWiki supports [[doku>wiki:interwiki|Interwiki]] links. These are quick links to other Wikis. For example this is a link to Wikipedia's page about Wikis: [[wp>Wiki]].
72
73  DokuWiki supports [[doku>wiki:interwiki|Interwiki]] links. These are quick links to other Wikis.
74  For example this is a link to Wikipedia's page about Wikis: [[wp>Wiki]].
75
76==== Windows Shares ====
77
78Windows shares like [[\\server\share|this]] are recognized, too. Please note that these only make sense in a homogenous user group like a corporate [[wp>Intranet]].
79
80  Windows Shares like [[\\server\share|this]] are recognized, too.
81
82Notes:
83
84  * For security reasons direct browsing of windows shares only works in Microsoft Internet Explorer per default (and only in the "local zone").
85  * For Mozilla and Firefox it can be enabled through the config option [[http://www.mozilla.org/quality/networking/docs/netprefs.html#file|security.checkloaduri]] but this is not recommended
86  * See [[bug>151]] for more info
87
88==== Image Links ====
89
90You 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:
91
92  [[http://www.php.net|{{wiki:dokuwiki-128.png}}]]
93
94[[http://www.php.net|{{wiki:dokuwiki-128.png}}]]
95
96Please note: The image formatting is the only formatting syntax accepted in link names.
97
98The whole [[#images_and_other_files|image]] and [[#links|link]] syntax is supported (including image resizing, internal and external images and URLs and interwiki links).
99
100===== Footnotes =====
101
102You can add footnotes ((This is a footnote)) by using double parentheses.
103
104  You can add footnotes ((This is a footnote)) by using double parentheses.
105
106===== Sectioning =====
107
108You 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.
109
110==== Headline Level 3 ====
111=== Headline Level 4 ===
112== Headline Level 5 ==
113
114  ==== Headline Level 3 ====
115  === Headline Level 4 ===
116  == Headline Level 5 ==
117
118By using four or more dashes, you can make a horizontal line:
119
120----
121
122===== Images and other files =====
123
124You can include external and internal [[doku>images]] with curly brackets. Optionally you can specify the size of them.
125
126Real size:                        {{wiki:dokuwiki-128.png}}
127
128Resize to given width:            {{wiki:dokuwiki-128.png?50}}
129
130Resize to given width and height: {{wiki:dokuwiki-128.png?200x50}}
131
132Resized external image:           {{http://de3.php.net/images/php.gif?200x50}}
133
134  Real size:                        {{wiki:dokuwiki-128.png}}
135  Resize to given width:            {{wiki:dokuwiki-128.png?50}}
136  Resize to given width and height: {{wiki:dokuwiki-128.png?200x50}}
137  Resized external image:           {{http://de3.php.net/images/php.gif?200x50}}
138
139
140By using left or right whitespaces you can choose the alignment
141
142{{ wiki:dokuwiki-128.png}}
143
144{{wiki:dokuwiki-128.png }}
145
146{{ wiki:dokuwiki-128.png }}
147
148  {{ wiki:dokuwiki-128.png}}
149  {{wiki:dokuwiki-128.png }}
150  {{ wiki:dokuwiki-128.png }}
151
152Of course, you can add a title (displayed as a tooltip by most browsers), too.
153
154{{ wiki:dokuwiki-128.png |This is the caption}}
155
156  {{ wiki:dokuwiki-128.png |This is the caption}}
157
158If you specify a filename (external or internal) that is not an image (''gif,jpeg,png''), then it will be displayed as a link instead.
159
160For linking an image to another page see [[Image Links]] above.
161
162===== Lists =====
163
164Dokuwiki 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.
165
166  * This is a list
167  * The second item
168    * You may have different levels
169  * Another item
170
171  - The same list but ordered
172  - Another item
173    - Just use indention for deeper levels
174  - That's it
175
176<code>
177  * This is a list
178  * The second item
179    * You may have different levels
180  * Another item
181
182  - The same list but ordered
183  - Another item
184    - Just use indention for deeper levels
185  - That's it
186</code>
187
188===== Smileys =====
189
190DokuWiki converts commonly used [[wp>emoticon]]s to their graphical equivalents. More smileys can be placed in the ''smiley'' directory and configured in the ''conf/smileys.conf'' file. Here is an overview of Smileys included in DokuWiki.
191
192  * 8-) %%  8-)  %%
193  * 8-O %%  8-O  %%
194  * :-( %%  :-(  %%
195  * :-) %%  :-)  %%
196  * =)  %%  =)   %%
197  * :-/ %%  :-/  %%
198  * :-\ %%  :-\  %%
199  * :-? %%  :-?  %%
200  * :-D %%  :-D  %%
201  * :-P %%  :-P  %%
202  * :-O %%  :-O  %%
203  * :-X %%  :-X  %%
204  * :-| %%  :-|  %%
205  * ;-) %%  ;-)  %%
206  * ^_^ %%  ^_^  %%
207  * :?: %%  :?:  %%
208  * :!: %%  :!:  %%
209  * LOL %%  LOL  %%
210  * FIXME %%  FIXME %%
211  * DELETEME %% DELETEME %%
212
213===== Typography =====
214
215[[DokuWiki]] can convert simple text characters to their typographically correct entities. Here is an example of recognized characters.
216
217-> <- <-> => <= <=> >> << -- --- 640x480 (c) (tm) (r)
218"He thought 'It's a man's world'..."
219
220<code>
221-> <- <-> => <= <=> >> << -- --- 640x480 (c) (tm) (r)
222"He thought 'It's a man's world'..."
223</code>
224
225Please note: These conversions can be turned off through a [[doku>wiki:config#typography|config option]] and a [[doku>wiki:entities|pattern file]].
226
227===== Quoting =====
228
229Some times you want to mark some text to show it's a reply or comment. You can use the following syntax:
230
231  I think we should do it
232
233  > No we shouldn't
234
235  >> Well, I say we should
236
237  > Really?
238
239  >> Yes!
240
241  >>> Then lets do it!
242
243I think we should do it
244
245> No we shouldn't
246
247>> Well, I say we should
248
249> Really?
250
251>> Yes!
252
253>>> Then lets do it!
254
255===== Tables =====
256
257DokuWiki supports a simple syntax to create tables.
258
259^ Heading 1      ^ Heading 2       ^ Heading 3          ^
260| Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
261| Row 2 Col 1    | some colspan (note the double pipe) ||
262| Row 3 Col 1    | Row 2 Col 2     | Row 2 Col 3        |
263
264Table rows have to start and end with a ''|'' for normal rows or a ''^'' for headers.
265
266  ^ Heading 1      ^ Heading 2       ^ Heading 3          ^
267  | Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
268  | Row 2 Col 1    | some colspan (note the double pipe) ||
269  | Row 3 Col 1    | Row 2 Col 2     | Row 2 Col 3        |
270
271To connect cells horizontally, just make the next cell completely empty as shown above. Be sure to have always the same amount of cell separators!
272
273Vertical tableheaders are possible, too.
274
275|              ^ Heading 1            ^ Heading 2          ^
276^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
277^ Heading 4    | no colspan this time |                    |
278^ Heading 5    | Row 2 Col 2          | Row 2 Col 3        |
279
280As you can see, it's the cell separator before a cell which decides about the formatting:
281
282  |              ^ Heading 1            ^ Heading 2          ^
283  ^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
284  ^ Heading 4    | no colspan this time |                    |
285  ^ Heading 5    | Row 2 Col 2          | Row 2 Col 3        |
286
287Note: Vertical spans (rowspan) are not possible.
288
289You 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.
290
291^           Table with alignment           ^^^
292|         right|    center    |left          |
293|left          |         right|    center    |
294| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
295
296This is how it looks in the source:
297
298  ^           Table with alignment           ^^^
299  |         right|    center    |left          |
300  |left          |         right|    center    |
301  | xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
302
303===== Nonparsed Blocks =====
304
305You can include non parsed 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''.
306
307<code>
308This is preformatted code all spaces are preserved: like              <-this
309</code>
310
311<file>
312This is pretty much the same, but you could use it to show that you quoted a file.
313</file>
314
315To let the parser ignore an area completely (ie. do no formatting on it), enclose the area either with ''nowiki'' tags or even simpler, with double percent signs ''<nowiki>%%</nowiki>''.
316
317<nowiki>
318This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it.
319</nowiki>
320
321See the source of this page to see how to use these blocks.
322
323===== Syntax Highlighting =====
324
325[[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 is the same like in the code block in the previous section, but this time the name of the used language is inserted inside the tag. Eg. ''<nowiki><code java></nowiki>''.
326
327<code java>
328/**
329 * The HelloWorldApp class implements an application that
330 * simply displays "Hello World!" to the standard output.
331 */
332class HelloWorldApp {
333    public static void main(String[] args) {
334        System.out.println("Hello World!"); //Display the string.
335    }
336}
337</code>
338
339The following language strings are currently recognized: //actionscript, actionscript-french, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, caddcl, cadlisp, c, c_mac, cfm, cpp, csharp, css, delphi, diff, d, div, dos, eiffel, freebasic, gml, groovy, html4strict, ini, inno, java, java5, javascript, lisp, lua, matlab, mpasm, mysql, nsis, objc, ocaml, ocaml-brief, oobas, oracle8, pascal, perl, php-brief, php, python, qbasic, scheme, sdlbasic, smarty, sql, tcl, text, tsql, reg, robots, ruby, vb, vbnet, vhdl, visualfoxpro, winbatch, xml//
340
341===== Embedding HTML and PHP =====
342
343You can embed raw HTML or PHP code into your documents by using the ''html'' or ''php'' tags like this:
344<code>
345<html>
346This is some <font color="red" size="+1">HTML</font>
347</html>
348</code>
349
350<html>
351This is some <font color="red" size="+1">HTML</font>
352</html>
353
354<code>
355<php>
356echo 'A logo generated by PHP:';
357echo '<img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" />';
358</php>
359</code>
360
361<php>
362echo 'A logo generated by PHP:';
363echo '<img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" />';
364</php>
365
366**Please Note**: HTML and PHP embedding is disabled by default in the configuration. If disabled, the code is displayed instead of executed.
367
368===== Syntax Plugins =====
369
370DokuWiki's syntax can be extended by [[doku>wiki: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:
371
372~~INFO:syntaxplugins~~