symposion_app/symposion/markdown_parser.py
Patrick Altman 11f697d137 Massively upgrade symposion
* Remove markitup (to be replaced with Ace editor)
* Use DUA decorators
* Removed custom signup bits
* Upgraded dependencies
* Added migrations
* Namespaced template locations
* Removed html5parser/sanitizer (for now) - parsing functionality
should be moved out entirely to a hooks
* Replaced ProposalScoreExpression object with a  function that returns
F() expressions
2015-10-16 12:37:35 -05:00

18 lines
497 B
Python

from __future__ import unicode_literals
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:
# bits.append(token.toxml())
# return "".join(bits)
return text