18

Is there a python library which takes wikitext (as used in mediawiki) input and converts it to markdown?

Ed L
  • 1,947
  • 2
  • 17
  • 30
  • Can you even do that? I never really used wikitext, but isn't it orders of magnitude more powerful/fine-grained than markdown? –  Feb 12 '11 at 22:06
  • 1
    It doesn't need to be a perfect conversion, as long as it preserves the general structure. – Ed L Feb 12 '11 at 22:29

5 Answers5

15

Since is something that I need, I packaged both together:

http://bitbucket.org/wikier/mw2md

So now it's easier to perform both tasks.

wikier
  • 2,517
  • 2
  • 26
  • 39
6

You can go from wikitext to html and then go from html to markdown. Not exactly straight forward, but i know no alternatives.

Jochen Ritzel
  • 104,512
  • 31
  • 200
  • 194
4

Not sure it does what you want, but you might want to check out Pyandoc: a Python wrapper for Pandoc.

Sam Dutton
  • 14,775
  • 6
  • 54
  • 64
4

You can use pandoc for this. Try online converter.

Artem Klevtsov
  • 9,193
  • 6
  • 52
  • 57
2

You can use pandoc with following syntax to convert from mediwiki to markdown.

 pandoc -f mediawiki -t markdown wiki.txt

this will output on console but if you want to save it in a file then change as below.

pandoc --from mediawiki --to markdown wiki.txt  -o youwant.md
Evan Hu
  • 977
  • 1
  • 13
  • 18
FarIDM
  • 109
  • 6