info:dw2md

Migrer dokuwiki -> markdown

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

https://github.com/ludoza/DokuWiki-to-Markdown-Converter

pour les curieux uniquement copie locale de https://earthscinotebook.readthedocs.io/en/latest/wiki/transition2markdown/

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…

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