Is there a python library which takes wikitext (as used in mediawiki) input and converts it to markdown?
Asked
Active
Viewed 1.0k times
18
-
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
-
1It 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 Answers
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
-
Here's what I see when I try to access that link: https://i.imgur.com/0jY04pX.png – Raleigh L. Oct 01 '22 at 06:08
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
-
1Unfortunately, this is for WikiCreole. It doesn't seem to work for MediaWiki markup. I have not yet found a reliable standalone Mediawiki to HTML-or-whatever converter. – mivk May 31 '14 at 13:48
-
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
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