Migrating from Dokuwiki to markdown pages
I am in the process of migrating my old wiki from a Dokuwiki installation to a collection of markdown pages that I can maintain with git and some web tools (GitHub, ReadtheDocs, etc).
Steps for this are:
-
Use dokuwiki2git to export a git repository of the pages
-
Copy pages to new directory and change permissions of those pages
-
Convert dokuwiki to markdown using the pandoc mediawiki converter:
find . -name \*.txt -type f -exec pandoc -f mediawiki -t markdown -o {}.md {} \;
-
do some custom editing of the new markdown pages
for file in *.txt.md; do git mv "$file" "${file//txt./}"; done
-
replace nonbreaking spaces in vim
:%s/<NBSP>/ /g
where entering
<NBSP>
is accomplished with<CTRL-k>+space+space
. OR - remove in all files with sed:find . -type f -exec sed -i 's/\xC2\xA0/ /g' {} +
-
Replace other stuff with sed:
find . -type f -exec sed -i 's/ "wikilink"//g' {} + find . -type f -exec sed -i 's/<\/code>/~~~/g' {} + find . -type f -exec sed -i 's/<code bash>/~~~/g' {} + find . -type f -exec sed -i 's/- - / **/g' {} +
-
Change all links to the markdown convention of:
[linktext]({subdir/}markdownpage.md)
or, for relative links to pages in other subdirectories:
[linktext](/subdir/markdownpage.md)
-
Convert tables - a pain...