GitHub Flavoured Markdown

While not strictly a Flask-dependent module, Coaster offers an implementation of GitHub-flavoured Markdown (GFM) as a convenience feature.

GFM exists because normal markdown has some vicious gotchas. Further reading:

This is a Python port of GitHub code, taken from


Prepare text for rendering by a regular Markdown processor.

coaster.gfm.markdown(text, html=False, valid_tags={'a': ['href', 'title', 'target', 'rel'], 'abbr': ['title'], 'b': [], 'blockquote': [], 'br': [], 'caption': [], 'cite': [], 'code': [], 'col': ['align', 'char', 'charoff'], 'colgroup': ['align', 'span', 'cols', 'char', 'charoff', 'width'], 'dd': [], 'del': [], 'dl': [], 'dt': [], 'em': [], 'h3': [], 'h4': [], 'h5': [], 'h6': [], 'hr': [], 'i': [], 'img': ['src', 'width', 'height', 'align', 'alt'], 'ins': [], 'li': ['start'], 'mark': [], 'ol': [], 'p': [], 'pre': ['class'], 'span': ['class'], 'strong': [], 'sub': [], 'sup': [], 'table': ['class', 'align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'width'], 'tbody': ['align', 'char', 'charoff', 'valign'], 'td': ['align', 'char', 'charoff', 'colspan', 'rowspan', 'valign'], 'tfoot': ['align', 'char', 'charoff', 'valign'], 'th': ['align', 'char', 'charoff', 'colspan', 'rowspan', 'valign'], 'thead': ['align', 'char', 'charoff', 'valign'], 'tr': ['align', 'char', 'charoff', 'valign'], 'ul': []})[source]

Return Markdown rendered text using GitHub Flavoured Markdown, with HTML escaped and syntax-highlighting enabled.