Django Markdownify - A Django Markdown filter
Django Markdownify is a template filter to convert Markdown to HTML in Django. Markdown is converted to HTML and sanitized.
Read the full documentation on Read the docs or check out the package on pypi.
[!WARNING]
The old settings are removed in release 0.9.4! Please update to the new settings as soon as possible.
Usage
Load the tag inside your template:
{% load markdownify %}
Then you can change markdown to html as follows:
{{ 'text'|markdownify }}
or
{{ somevariable|markdownify }}
Example
{% load markdownify %}
{{'Some *test* [link](#)'|markdownify }}
Is transformed to:
<p>
Some <em>test</em> <a href="#">link</a>
</p>
The filter is a wrapper around Markdown and Bleach and as such supports their settings. It is possible to define multiple settings for multiple usecases.
For example:
# settings.py
MARKDOWNIFY = {
"default": {
"WHITELIST_TAGS": ["a", "p", "h1", ]
},
"alternative": {
"WHITELIST_TAGS": ["a", "p", ],
"MARKDOWN_EXTENSIONS": ["markdown.extensions.fenced_code", ]
}
}
And in your templates:
<!-- page1.html -->
{{ mytext|markdownify }} <!-- Uses your default settings -->
<!-- page2.html -->
{{ mytext|markdownify:"alternative" }} <!-- Uses your alternative settings -->
Documentation
Read the full documentation on Read the docs.
Credits
This filter is a slightly richer and packaged version of the snippet: using-markdown-django-17.
Metadata
Release files for django-markdownify 0.9.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_markdownify-0.9.7.tar.gz | 8.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_markdownify-0.9.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.5 kB
Release files / django_markdownify-0.9.7.tar.gz
| Download URL | django_markdownify-0.9.7.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e59dfd445ad6362288f7bc1574e45d8356848463e261b878fd70df6a272c47f
|
|
BLAKE2b-256 checksum How to use checksums |
dbae2ecbac028f470ed78b8826413495d5ea60c9d53d7af000729ff3a7663ff8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / django_markdownify-0.9.7-py3-none-any.whl
| Download URL | django_markdownify-0.9.7-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca3a6361f952d1c1b661c13229f69219a36e745358aa0f377212aef8f09e4cf3
|
|
BLAKE2b-256 checksum How to use checksums |
34b99b1a28f605ad75fa7e4588f51661eb3c7c5feb5ad23e985761e9a14d01c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for django-markdownify 0.9.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.