Child: [a027b8] (diff)

Download this file

converters.py    13 lines (11 with data), 422 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#-*- python -*-
import html2text
import bbcode
# https://github.com/zikzakmedia/python-mediawiki.git
from mediawiki import *
def mediawiki2markdown(source):
p = bbcode.Parser(newline='\n', escape_html=False, replace_links=False, replace_cosmetic=False)
cleanbb_text = p.format(source)
wiki_content = wiki2html(cleanbb_text, True)
markdown_text = html2text.html2text(wiki_content)
return markdown_text