Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (12 sloc) 455 Bytes
import html5lib
from html5lib import html5parser, sanitizer
import markdown
def parse(text):
# First run through the Markdown parser
text = markdown.markdown(text, extensions=["extra"], safe_mode=False)
# Sanitize using html5lib
bits = []
parser = html5parser.HTMLParser(tokenizer=sanitizer.HTMLSanitizer)
for token in parser.parseFragment(text).childNodes:
return "".join(bits)
Something went wrong with that request. Please try again.