mkbabb / jinja-markdown2

Simple Jinja extension that allows for markdown processing after templating.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jinja-markdown2

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

Usage

Python:

...
from jinja_markdown2 import MarkdownExtension

jinja_env = ...
jinja_env.add_extension(MarkdownExtension)
...

Markdown:

{% markdown %}

## Hello {{ world_name }}

{% endmarkdown %}

About

Simple Jinja extension that allows for markdown processing after templating.

License:The Unlicense


Languages

Language:Python 83.8%Language:HTML 16.2%