DokuWiki Syntax — Headings, Bold, Italic, Lists, and Code Blocks
In this tutorial, you'll learn DokuWiki's lightweight markup syntax for formatting text, creating lists, writing code blocks, and organizing content with headings and horizontal rules.
What You'll Learn
- DokuWiki heading levels (H1 through H5)
- Text formatting: bold, italic, underlined, monospace, and deleted
- Bullet lists and numbered lists with nesting
- Code blocks with syntax highlighting
- Horizontal rules and line breaks
- Indentation and blockquote syntax
Why It Matters
DokuWiki uses its own lightweight markup language. It is different from Markdown, MediaWiki syntax, and HTML. If you come from another wiki platform, the syntax looks familiar but has important differences. Learning the syntax properly means you write content faster, avoid formatting errors, and produce clean, readable pages.
Real-World Use
A technical writer documents an API in DokuWiki. They use heading levels to structure the page (H1 for the API name, H2 for endpoints, H3 for parameters), code blocks for request and response examples, bullet lists for parameter tables, and bold for emphasis on important notes. The rendered page is clean, scannable, and easy to navigate. Developers find the information they need within seconds.
Learning Path
flowchart LR A[First Wiki Page] --> B[DokuWiki Syntax] B --> C[Links and Images] C --> D[Tables] D --> E[Media Management] E --> F[Sidebar] F --> G[Namespaces]
Headings
DokuWiki headings use the equals sign (=). The number of equals signs indicates the level:
====== Heading Level 1 ====== (H1)
===== Heading Level 2 ===== (H2)
==== Heading Level 3 ==== (H3)
=== Heading Level 4 === (H4)
== Heading Level 5 == (H5)
The opening and closing equals must match. A space after the opening and before the closing is not required but improves readability.
Try to have only one H1 per page. The page title typically uses H1, and your sections use H2 and below.
Text Formatting
DokuWiki uses specific markup for text styles:
| Style | Syntax | Rendered |
|---|---|---|
| Bold | **Bold text** |
Bold text |
| //Italic// | //Italic text// |
Italic text |
| Underlined | __Underlined text__ |
Underlined text |
| ''Monospace'' | ''Monospace text'' |
Monospace text |
~~Deleted text~~ |
||
| Superscript | <sup>superscript</sup> |
superscript |
| Subscript | <sub>subscript</sub> |
subscript |
You can combine styles. **//Bold italic//** renders as Bold italic.
DokuWiki uses double slashes for italic, not single asterisks like Markdown. This is one of the most common points of confusion for newcomers.
Lists
Bullet Lists
Use asterisks for bullet lists. Indent with two spaces for nesting:
* Item 1
* Item 2
* Sub-item 2a
* Sub-item 2b
* Sub-sub-item 2b-i
* Item 3
Rendered:
- Item 1
- Item 2
- Sub-item 2a
- Sub-item 2b
- Sub-sub-item 2b-i
- Item 3
Numbered Lists
Use hyphens for numbered lists:
- First item
- Second item
- Sub-item A
- Sub-item B
- Third item
Rendered:
- First item
- Second item
- Sub-item A
- Sub-item B
- Third item
Mixed Lists
You can mix bullet and numbered lists:
* Bullet item
- Numbered sub-item
- Another numbered sub-item
* Another bullet item
* Bullet sub-item
Code Blocks
Inline Code
For code within a sentence, use double quotes (backtick equivalents in DokuWiki):
The `echo` command outputs text.
Renders as: The echo command outputs text.
Note: DokuWiki uses '' (two single quotes) for monospace, which is different from the backticks used in Markdown.
Block Code
For multi-line code, use the <code> tag with an optional language parameter for syntax highlighting:
<code php>
<?php
echo "Hello, DokuWiki!";
function greet($name) {
return "Hello, $name!";
}
echo greet("World");
?>
</code>
Supported languages include: php, JavaScript, python, bash, html, css, sql, xml, and many more.
File Blocks
Use <file> for downloadable code blocks:
<file python hello.py>
def greet(name):
return f"Hello, {name}!"
print(greet("World"))
</file>
The <file> tag adds a filename label and a download link.
No Highlighting
Use <code> without a language parameter for plain text:
<code>
This is a plain text block
with no syntax highlighting.
</code>
Horizontal Rules
Four or more hyphens create a horizontal rule:
----
This renders as a horizontal line across the page. Use it to separate sections visually.
Indentation and Blockquotes
Use > at the start of a line for indentation or blockquotes:
> This is a blockquote.
> It can span multiple lines.
>
> > Nested blockquotes work too.
For simple indentation, use two spaces at the start of the line:
Normal text
Indented text
Further indented text
Line Breaks
To force a line break without starting a new paragraph, use two backslashes at the end of a line:
First line\\
Second line
Without the double backslash, adjacent lines are joined into a single paragraph.
Special Characters
DokuWiki converts common special characters automatically:
->becomes an arrow (→)<-becomes a left arrow (←)<->becomes a double arrow (↔)=>becomes a double arrow (⇒)(c)becomes copyright (©)(tm)becomes trademark (™)(r)becomes registered (®)
Putting It All Together
Here is a complete example page using multiple formatting elements:
====== Server Setup Guide ======
This page describes the **standard server configuration** for all new projects.
----
===== System Requirements =====
- Operating System: Ubuntu 22.04 LTS
- PHP version: 8.1 or later
- //Minimum// RAM: 2 GB
- Disk space: //20 GB// (//recommended//: 40 GB)
===== Installation Steps =====
Follow these steps in order:
1. Update the system
2. Install PHP and extensions
3. Configure the web server
4. //Verify the installation//
===== Configuration File =====
<code php /etc/php/8.1/cli/conf.d/custom.ini>
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 120
</code>
----
**Note:** Reboot the web server after changes.
Common Mistakes
- Using Markdown syntax: If you come from Markdown, you will instinctively write
# Heading,*italic*, and`code`. DokuWiki uses different syntax. The most common mistake is using*italic*instead of//italic//. - Incorrect heading syntax: Forgetting the closing equals signs (
===== Headingwithout=====at the end) breaks the heading. Both opening and closing marks are required. - Using tabs for list indentation: DokuWiki requires spaces, not tabs, for list nesting. Using tabs creates rendering artifacts.
- Missing space after list markers:
*Itemwithout a space after the asterisk does not create a list item. Always write* Item. - Overusing heading levels: Jumping from H1 to H4 without H2 and H3 creates confusing document structure. Use headings hierarchically.
Practice Questions
- How do you create a level-2 heading in DokuWiki, and how does this differ from Markdown and MediaWiki?
- Write the DokuWiki syntax for: bold text, italic text, monospace text, and a bullet list with three items.
- What is the difference between the
<code>and<file>tags in DokuWiki? - Challenge: Write a complete DokuWiki page that documents a simple REST API endpoint. Use H2 for the endpoint name, H3 for request parameters, a bullet list for parameter descriptions, a code block for a sample request (JSON), a table for response codes, and formatting (bold, italic, monospace) for emphasis. The page should be at least 150 words of content plus code examples.
FAQ
Mini Project
Goal: Create a well-formatted documentation page.
- Create a new page called
formatting-practicein your wiki - Add a level-1 heading: "DokuWiki Formatting Practice"
- Add three level-2 sections: "Text Styles", "Lists", and "Code Examples"
- In "Text Styles," demonstrate bold, italic, underlined, and monospace text
- In "Lists," create a nested bullet list (3 levels deep) and a numbered list
- In "Code Examples," add a PHP code block and a Python code block with syntax highlighting
- Add a horizontal rule before each section
- Preview and save, then verify the rendering matches your expectations
What's Next
Now you can format text. Learn to create links and images to connect your pages and add visual content.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro