def markdown(text, html=False, valid_tags=GFM_TAGS):
    """
    Return Markdown rendered text using GitHub Flavoured Markdown,
    with HTML escaped and syntax-highlighting enabled.
    """
    if text is None:
        return None
    if html:
        return Markup(sanitize_html(markdown_convert_html(gfm(text)), valid_tags=valid_tags))
    else:
        return Markup(markdown_convert_text(gfm(text)))
Return Markdown rendered text using GitHub Flavoured Markdown,
    with HTML escaped and syntax-highlighting enabled.