Parent: [72b8ee] (diff)

Child: [d63c6c] (diff)

Download this file

converters.py    17 lines (13 with data), 465 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#-*- python -*-
import html2text
import bbcode
# https://github.com/zikzakmedia/python-mediawiki.git
from mediawiki import wiki2html
html2text.BODY_WIDTH = 0
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