(text, post=None, clean=True, escape=True, allow_rewrite=False)
return output
Parses markdown into html.
    Expands certain patterns into HTML.

    clean : Applies bleach clean BEFORE mistune escapes unsafe characters.
            Also removes unbalanced tags at this stage.
    escape  : Escape html originally found in the markdown text.
    allow_rewrite : Serve images with relative url paths from the static directory.
                  eg. images/foo.png -> /static/images/foo.png
Parses markdown into html.
    Expands certain patterns into HTML.
Parses markdown into html . Expands certain patterns into HTML .
def parse(text, post=None, clean=True, escape=True, allow_rewrite=False):
    """
    Parses markdown into html.
    Expands certain patterns into HTML.

    clean : Applies bleach clean BEFORE mistune escapes unsafe characters.
            Also removes unbalanced tags at this stage.
    escape  : Escape html originally found in the markdown text.
    allow_rewrite : Serve images with relative url paths from the static directory.
                  eg. images/foo.png -> /static/images/foo.png
    """

    # Resolve the root if exists.
    root = post.parent.root if (post and post.parent) else None

    # Initialize the renderer
    renderer = BiostarRenderer(escape=escape)

    # Initialize the lexer
    inline = BiostarInlineLexer(renderer=renderer, root=root, allow_rewrite=allow_rewrite)

    markdown = mistune.Markdown(hard_wrap=True, renderer=renderer, inline=inline)

    output = markdown(text=text)
    # Bleach clean the html.
    if clean:
        output = bleach.clean(text=output,
                            tags=ALLOWED_TAGS,
                            styles=ALLOWED_STYLES,
                            attributes=ALLOWED_ATTRIBUTES,
                            protocols=ALLOWED_PROTOCOLS)
    # Embed sensitive links into html
    output = linkify(text=output)

    return output
def parse ( text , post = None , clean = True , escape = True , allow_rewrite = False ) : # Resolve the root if exists. root = post . parent . root if ( post and post . parent ) else None # Initialize the renderer renderer = BiostarRenderer ( escape = escape ) # Initialize the lexer inline = BiostarInlineLexer ( renderer = renderer , root = root , allow_rewrite = allow_rewrite ) markdown = mistune . Markdown ( hard_wrap = True , renderer = renderer , inline = inline ) output = markdown ( text = text ) # Bleach clean the html. if clean : output = bleach . clean ( text = output , tags = ALLOWED_TAGS , styles = ALLOWED_STYLES , attributes = ALLOWED_ATTRIBUTES , protocols = ALLOWED_PROTOCOLS ) # Embed sensitive links into html output = linkify ( text = output ) return output