Is there a python library which takes wikitext (as used in mediawiki) input and converts it to markdown?
Not sure it does what you want, but you might want to check out Pyandoc: a Python wrapper for Pandoc.