GitHub Flavoured Markdown

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

GitHub Flavoured Markdown: because normal markdown has some vicious gotchas.

Further reading on the gotchas:

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={'em': [], 'pre': ['class'], 'dl': [], 'code': [], 'ins': [], 'hr': [], 'h3': [], 'dd': [], 'h6': [], 'h4': [], 'h5': [], 'blockquote': [], 'abbr': ['title'], 'br': [], 'table': ['class', 'align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'width'], 'li': ['start'], 'dt': [], 'strong': [], 'a': ['href', 'title', 'target', 'rel'], 'col': ['align', 'char', 'charoff'], 'ol': [], 'span': ['class'], 'sub': [], 'img': ['src', 'width', 'height', 'align', 'alt'], 'p': [], 'i': [], 'caption': [], 'colgroup': ['align', 'span', 'cols', 'char', 'charoff', 'width'], 'tr': ['align', 'char', 'charoff', 'valign'], 'tbody': ['align', 'char', 'charoff', 'valign'], 'mark': [], 'ul': [], 'del': [], 'tfoot': ['align', 'char', 'charoff', 'valign'], 'th': ['align', 'char', 'charoff', 'colspan', 'rowspan', 'valign'], 'sup': [], 'td': ['align', 'char', 'charoff', 'colspan', 'rowspan', 'valign'], 'b': [], 'cite': [], 'thead': ['align', 'char', 'charoff', 'valign']})

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