/DokuWiki-to-Markdown-Converter

Tools to convert the DokuWiki syntax to Markdown syntax. Please note it has some specific Liquibase regular expressions.

Primary LanguagePHPOtherNOASSERTION

DokuWiki to Markdown Converter

Introduction

Tools to convert the DokuWiki syntax to Markdown syntax. Please note it has some specific Liquibase regular expressions in scripts/DocuwikiToMarkdownExtra.php.

TODOS

Fix the following conversion inconsistencies

<del> is replaced by `<del>`. It should re replaced by <strike> - without the `` wrap
\\ should be replaced by 4 spaces and a line break
Links should be encapsulated by <>
bullets (like * or -) should have no spaces in front of them, and only one after
rowspans (:::) in tables are not supported
colspans aren't supported either, due to limitations in Markdown syntax - instead, empty cells will be inserted

Convert single files

Place a file in the input dir, and run:

php convert.php input/myfile.txt

This will convert your file, and place a myfile.md next to your file.

Advanced usage (not yet tested)

Import an entire wiki

scp -P 2222 -r <username>@myserver:/sites/mysite/www/assets/data/pages/* input/

Convert to Markdown files

cd scripts
php Translate.php ../input <../output> < template.txt>

../output - if output is not supplied it will print the conversion to stdout.

template.txt - at the moment it only prepends the content of the template to each file it converts.

Images

The script will generate Markdown code for images. Notes:

  • As Markdown doesn't support resizing, the images are always shown full size!
  • The script doesn't copy image files; it just creates image links. It is up to the user to copy the images from DokuWikis data/media directory to the directory containing the Markdown file(s). Eg.:
cp -rp /srv/www/wiki/htdocs/data/media/. ../output/

Credit