Django-Jinja (Jinja2) extension and filter to parse markdown text in templates.
Install django-jinja-markdown:
pip install django-jinja-markdown
Add django_jinja_markdown
to INSTALLED_APPS
.
To be able to use the {% markdown %}
tag you should add the Jinja extension to your django_jinja
TEMPLATES extensions list:
TEMPLATES = [
{
'BACKEND': 'django_jinja.backend.Jinja2',
'OPTIONS': {
'extensions': [
'django_jinja_markdown.extensions.MarkdownExtension',
],
}
},
]
Examples of using filter in template:
{{ content|markdown }}
{{ markdown('this is **bold**') }}
Or with additional settings:
{{ content|markdown(extensions=['nl2br',]) }}
{{ markdown(content, extensions=['nl2br',]) }}
Example of using extension:
{% markdown %}
Text which will get converted with Markdown.
{% endmarkdown %}
This software is licensed under The MIT License (MIT). For more information, read the file LICENSE.
Forked in 2016 from the jingo-markdown project. Please see CHANGELOG for more history.
- Update the version number in
django_jinja_markdown/__about__.py
. - Add an entry to the change log in the README file.
- Tag the commit where you changed the above with the version number: e.g.
1.21
. - Push the commit and tag to the github repo.
- Create a new GitHub release, selecting the tag you just pushed to specify the commit. Hit Publish.
- Github will build and release the package to PyPI. Monitor the progress via the Actions tab.