Skip to main content

A jinja2 markdown tag powered with PyMdown Extensions.

Project description

Jinja-Markdown

Tests

A jinja2 extension that adds a {% markdown %} tag powered with PyMdown Extensions.

Installation

pip install jinja_markdown

Usage

jinja_env = Environment(extensions=['jinja_markdown.MarkdownExtension'])

or

from jinja_markdown import MarkdownExtension

jinja_env.add_extension(MarkdownExtension)

Then your templates can contain Markdown inside {% markdown %} / {% endmarkdown %} block tags.

<article>
{% markdown %}
# Heading
Regular text

    print("Hello world!")
{% endmarkdown %}
</article>

About indentation

To avoid issues is recommended that you don't indent the markdown code inside the tag. If you prefer do it anyway, make sure the first line has the baseline indentation level.

<!-- Supported but not recommended -->
<article>
    {% markdown %}
    # Baseline of identation
    Regular paragraph

        This will be interpreted as code
</article>

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_markdown-1.210911.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

jinja_markdown-1.210911-py3-none-any.whl (3.4 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