Skip to main content

A Jinja2 extension for rendering Markdown with markdown2.

Project description

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 %}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jinja_markdown2-0.3.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

jinja_markdown2-0.3.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page