xref: /dokuwiki/data/pages/wiki/syntax.txt (revision 55efc227eaeb2d480ff22837b78f89766b07fe5f)
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]] 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, it's 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 (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
98===== Footnotes =====
99
100You can add footnotes ((This is a footnote)) by using double parenthesises.
101
102  You can add footnotes ((This is a footnote)) by using double parenthesises.
103
104===== Sectioning =====
105
106You 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.
107
108==== Headline Level 3 ====
109=== Headline Level 4 ===
110== Headline Level 5 ==
111
112  ==== Headline Level 3 ====
113  === Headline Level 4 ===
114  == Headline Level 5 ==
115
116By using four or more dashes, you can make a horizontal line:
117
118----
119
120===== Images and other files =====
121
122You can include external and internal [[doku>images]] with curly brackets. Optionally you can specify the size of them.
123
124Real size:                        {{wiki:dokuwiki-128.png}}
125
126Resize to given width:            {{wiki:dokuwiki-128.png?50}}
127
128Resize to given width and height: {{wiki:dokuwiki-128.png?200x50}}
129
130Resized external image:           {{http://de3.php.net/images/php.gif?200x50}}
131
132  Real size:                        {{wiki:dokuwiki-128.png}}
133  Resize to given width:            {{wiki:dokuwiki-128.png?50}}
134  Resize to given width and height: {{wiki:dokuwiki-128.png?200x50}}
135  Resized external image:           {{http://de3.php.net/images/php.gif?200x50}}
136
137
138By using left or right whitespaces you can choose the alignment
139
140{{ wiki:dokuwiki-128.png}}
141
142{{wiki:dokuwiki-128.png }}
143
144{{ wiki:dokuwiki-128.png }}
145
146  {{ wiki:dokuwiki-128.png}}
147  {{wiki:dokuwiki-128.png }}
148  {{ wiki:dokuwiki-128.png }}
149
150Of course, you can add a title (displayed as a tooltip by most browsers), too.
151
152{{ wiki:dokuwiki-128.png |This is the caption}}
153
154  {{ wiki:dokuwiki-128.png |This is the caption}}
155
156If you specify a filename (external or internal) that is not an image (''gif,jpeg,png''), then it will be displayed as a link instead.
157
158===== Lists =====
159
160Dokuwiki 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.
161
162  * This is a list
163  * The second item
164    * You may have different levels
165  * Another item
166
167  - The same list but ordered
168  - Another item
169    - Just use indention for deeper levels
170  - That's it
171
172<code>
173  * This is a list
174  * The second item
175    * You may have different levels
176  * Another item
177
178  - The same list but ordered
179  - Another item
180    - Just use indention for deeper levels
181  - That's it
182</code>
183
184===== Smileys =====
185
186DokuWiki 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.
187
188  * 8-) %%  8-)  %%
189  * 8-O %%  8-O  %%
190  * :-( %%  :-(  %%
191  * :-) %%  :-)  %%
192  * =)  %%  =)   %%
193  * :-/ %%  :-/  %%
194  * :-\ %%  :-\  %%
195  * :-? %%  :-?  %%
196  * :-D %%  :-D  %%
197  * :-P %%  :-P  %%
198  * :-O %%  :-O  %%
199  * :-X %%  :-X  %%
200  * :-| %%  :-|  %%
201  * ;-) %%  ;-)  %%
202  * ^_^ %%  ^_^  %%
203  * :?: %%  :?:  %%
204  * :!: %%  :!:  %%
205  * LOL %%  LOL  %%
206  * FIXME %%  FIXME %%
207  * DELETEME %% DELETEME %%
208
209===== Typography =====
210
211[[DokuWiki]] can convert simple text characters to their typographically correct entities. Here is an example of recognized characters.
212
213-> <- <-> => <= <=> >> << -- --- 640x480 (c) (tm) (r)
214"He thought 'It's a man's world'..."
215
216<code>
217-> <- <-> => <= <=> >> << -- --- 640x480 (c) (tm) (r)
218"He thought 'It's a man's world'..."
219</code>
220
221Please note: These conversions can be turned off in the config file.
222
223===== Quoting =====
224
225Some times you want to mark some text to show it's a reply or comment. You can use the following syntax:
226
227  I think we should do it
228
229  > No we shouldn't
230
231  >> Well, I say we should
232
233  > Really?
234
235  >> Yes!
236
237  >>> Then lets do it!
238
239I think we should do it
240
241> No we shouldn't
242
243>> Well, I say we should
244
245> Really?
246
247>> Yes!
248
249>>> Then lets do it!
250
251===== Tables =====
252
253DokuWiki supports a simple syntax to create tables.
254
255^ Heading 1      ^ Heading 2       ^ Heading 3          ^
256| Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
257| Row 2 Col 1    | some colspan (note the double pipe) ||
258| Row 3 Col 1    | Row 2 Col 2     | Row 2 Col 3        |
259
260Table rows have to start and end with a ''|'' for normal rows or a ''^'' for headers.
261
262  ^ Heading 1      ^ Heading 2       ^ Heading 3          ^
263  | Row 1 Col 1    | Row 1 Col 2     | Row 1 Col 3        |
264  | Row 2 Col 1    | some colspan (note the double pipe) ||
265  | Row 3 Col 1    | Row 2 Col 2     | Row 2 Col 3        |
266
267To connect cells horizontally, just make the next cell completely empty as shown above. Be sure to have always the same amount of cell separators!
268
269Vertical tableheaders are possible, too.
270
271|              ^ Heading 1            ^ Heading 2          ^
272^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
273^ Heading 4    | no colspan this time |                    |
274^ Heading 5    | Row 2 Col 2          | Row 2 Col 3        |
275
276As you can see, it's the cell separator before a cell which decides about the formatting:
277
278  |              ^ Heading 1            ^ Heading 2          ^
279  ^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
280  ^ Heading 4    | no colspan this time |                    |
281  ^ Heading 5    | Row 2 Col 2          | Row 2 Col 3        |
282
283Note: Vertical spans (rowspan) are not possible.
284
285You 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.
286
287^           Table with alignment           ^^^
288|         right|    center    |left          |
289|left          |         right|    center    |
290| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
291
292This is how it looks in the source:
293
294  ^           Table with alignment           ^^^
295  |         right|    center    |left          |
296  |left          |         right|    center    |
297  | xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
298
299===== Nonparsed Blocks =====
300
301You 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''.
302
303<code>
304This is preformatted code all spaces are preserved: like              <-this
305</code>
306
307<file>
308This is pretty much the same, but you could use it to show that you quoted a file.
309</file>
310
311To 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>''.
312
313<nowiki>
314This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it.
315</nowiki>
316
317See the source of this page to see how to use these blocks.
318
319===== Syntax Highlighting =====
320
321[[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>''.
322
323<code java>
324/**
325 * The HelloWorldApp class implements an application that
326 * simply displays "Hello World!" to the standard output.
327 */
328class HelloWorldApp {
329    public static void main(String[] args) {
330        System.out.println("Hello World!"); //Display the string.
331    }
332}
333</code>
334
335The following language strings are currently recognized: //actionscript, ada, apache, asm, asp, bash, caddcl, cadlisp, c, c_mac, cpp, csharp, css, delphi, diff, d, html4strict, java, javascript, lisp, lua, matlab, mpasm, nsis, objc, oobas, oracle8, pascal, perl, php-brief, php, python, qbasic, smarty, sql, vb, vbnet, vhdl, visualfoxpro, xml//
336
337===== Embedding HTML and PHP =====
338
339You can embed raw HTML or PHP code into your documents by using the ''html'' or ''php'' tags like this:
340<code>
341<html>
342This is some <font color="red" size="+1">HTML</font>
343</html>
344</code>
345
346<html>
347This is some <font color="red" size="+1">HTML</font>
348</html>
349
350<code>
351<php>
352echo 'A logo generated by PHP:';
353echo '<img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" />';
354</php>
355</code>
356
357<php>
358echo 'A logo generated by PHP:';
359echo '<img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" />';
360</php>
361
362**Please Note**: HTML and PHP embedding is disabled by default in the configuration. If disabled, the code is displayed instead of executed.
363
364===== Syntax Plugins =====
365
366DokuWiki'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:
367
368~~INFO:syntaxplugins~~