def sanitize_markdown(value):
    return mark_safe(
        bleach.clean(
            markdown_func(value),
            tags=[
                'a',
                'abbr',
                'acronym',
                'b',
                'blockquote',
                'code',
                'em',
                'h1',
                'h2',
                'h3',
                'h4',
                'h5',
                'h6',
                'i',
                'li',
                'ol',
                'p',
                'pre',
                'strong',
                'ul',
            ],
        ))
Example #2
0
def sanitize_markdown(value):
    return mark_safe(
        bleach.clean(
            markdown_func(value),
            tags=[
                'a', 'abbr', 'acronym', 'b', 'blockquote', 'code', 'em',
                'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
                'i', 'li', 'ol', 'p', 'pre', 'strong', 'ul',
            ],
        )
    )
Example #3
0
def markdown(value, header_level=3):
    """
    Runs Markdown over a given value, optionally using various
    extensions python-markdown supports.

    Syntax::

        {{ value|markdown }}
    """
    return mark_safe(markdown_func(force_text(value), extensions=[
        'headerid(level=%d)' % (int(header_level),),
    ]))
Example #4
0
def markdown(value):
    """
    Run Markdown over a given value.
    """
    return mark_safe(markdown_func(value))
Example #5
0
def safe_markdown(value):
    """
    Strip raw HTML and run Markdown over a given value.
    """
    return mark_safe(bleach.clean(markdown_func(value)))
Example #6
0
def markdown(value):
    return markdown_func(value, extensions=['markdown.extensions.tables'])
Example #7
0
def markdown(value):
    return markdown_func(value)