Files @ 5b9f4fb71ed7
Branch filter:

Location: symposion_app/symposion/markdown_parser.py

Martey Dodoo
Loosen Django package requirement.

Loosen Django requirement to allow versions greater or equal to 1.8.5,
instead of mandating 1.8.5. This makes it easier to use newer releases
of Django (e.g. the bugfix and security releases 1.8.6 or 1.8.7) with
symposion.
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