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.4.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

jinja_markdown2-0.4.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file jinja_markdown2-0.4.0.tar.gz.

File metadata

  • Download URL: jinja_markdown2-0.4.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/24.0.0

File hashes

Hashes for jinja_markdown2-0.4.0.tar.gz
Algorithm Hash digest
SHA256 51addceeec19f4dffb90d495c423bf5196fe721991ebb67f08af637332224790
MD5 6235d084fd8fb4328e14c2164b7dc564
BLAKE2b-256 18bcf5905398419e4683cf1385eb5ba1217529f49e937b907ca1704d3276de4b

See more details on using hashes here.

File details

Details for the file jinja_markdown2-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: jinja_markdown2-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/24.0.0

File hashes

Hashes for jinja_markdown2-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee43255a20f97874006a1d003d13bdd27ba8c39708738df8bd5cd1ce6029ab01
MD5 ec8813f724ebdca67717c8a761671e27
BLAKE2b-256 79e4145cc23195b673d73f5cd27c760f7dc1fd1b890d9a4088413e9afe57cc38

See more details on using hashes here.

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