Inspired by the original jinja-markdown.
Uses jinja2
+ markdown2
to render markdown code after jinja's templating magic
(variable interpolation, etc.) is done. Critical difference between the naive:
Markdown -> HTML -> Jinja
Notice, the above processes the markdown first and jinja templating last. Whilst this approach technically works, it results in a myriad of problems with the resultant HTML that markdown2 formulates.
The flow is then:
HTML -> Jinja -> Markdown
Python:
...
from jinja_markdown2 import MarkdownExtension
jinja_env = ...
jinja_env.add_extension(MarkdownExtension)
...
Markdown:
{% markdown %}
## Hello {{ world_name }}
{% endmarkdown %}