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: http://blog.stackoverflow.com/2009/10/markdown-one-year-later/

This is a Python port of GitHub code, taken from https://gist.github.com/Wilfred/901706

coaster.gfm.gfm(text)[source]

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']})[source]

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