Help texts, release notes and content kept in a database are easier to write as Markdown. {markdown} writes what it wraps as HTML: the content renders first, so fields and tags in it resolve, and the result is then read as Markdown. The text is dedented first, so the block can be indented along with the template around it.
|
PHP fragments/markdown_1.php |
HTML fragments/markdown_1.pad |
Result |
|---|---|---|
|
|
Release notes for 2.1
|
A value - a post body from the database - goes through the markdown pipe, or
is given to the tag as its parameter: {markdown $post.body}. The HTML it
makes is safe by construction, so a field whose last pipe is markdown skips the
sanitize chain that would escape the markup again.
|
PHP fragments/markdown_2.php |
HTML fragments/markdown_2.pad |
Result |
|---|---|---|
|
|
Written by a visitor: <script>alert(1)</script> and |
html option of the tag lets the template author's own markup through; the pipe has no such form.javascript:, data: - keeps only its text.ignore option: {markdown ignore}.The built-in renderer is a CommonMark subset: headings, paragraphs, emphasis, code spans and code blocks, lists, links, images, block quotes and rules. Reference-style links, tables and footnotes are not supported.