I wrote this utility to help me migrate my DokuWiki content to MarkDown.
Best way to see what's supported and how is to look at syntax.md, which is the official DokuWiki Syntax file converted to MarkDown using this utility.
- Headers (all levels)
- Italic
- Bold
- Monospaced
- Strikethrough
- Code Blocks
- Lists
- Line breaks (make sure your editor doesn't trim white spaces)
- Removal of excess space character (2+ are left in place for MD newline)
- Removal of excess
\n
characters (to be more compliant with MarkDown)
- Links (only basic internal/external formats such as
[[https://example.com|Example]]
and[[https://example.com]]
- Underline (MarkDown doesn't have underline format so I chose bold instead)
- Images (mostly untested)
- Tables - only basic tables without colspan/rowspan
- Footnotes (not well tested, just basic
[^1]
)
- Everything not listed above
- Requires Python 3 (tested on Py 3.11 but it should work ok on older releases too)
- Obtain all
.txt
from your DokuWiki web directory (typically inpages
subdir) - Run
doku2md
to convert either one file or all TXT files in a directory structure
# Single file
./doku2md.py -f your_text_file.txt
# All files in pages/
./doku2md.py -d dokuwiki/pages
./doku2md.py -h
usage: doku2md.py [-h] (-f FILE | -d DIRECTORY) [-l LANG] [-T]
Convert Dokuwiki to Markdown.
options:
-h, --help show this help message and exit
-f FILE, --file FILE File to convert.
-d DIRECTORY, --directory DIRECTORY
Directory of files to convert.
-l LANG, --lang LANG Codeblocks will be labeled with this Language (eg. shell).
-T, --timestamps Keep textual timestamps in documents. (Default is to remove timestamps)
--lang
Creates code blocks typed with a shell of your choice. Eg.
```bash
cd /home
```
- Contributions are welcome
- Please update unit testing as necessary
- Don't modify
syntax.txt
file - As a part of your submission, regenerate
syntax.md
using./doku2md.py -f syntax.txt