Migrer dokuwiki -> markdown

Un super script php tout à fait fonctionnel à utiliser sans modération!

pour les curieux uniquement copie locale de

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 *; 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:


or, for relative links to pages in other subdirectories:


Convert tables - a pain…

  • info/dw2md.txt
  • Dernière modification: 2021/12/03 05:10
  • de radeff