Skip to content

mozmeao/django-jinja-markdown

 
 

Repository files navigation

Django-Jinja-Markdown

image

image

Django-Jinja (Jinja2) extension and filter to parse markdown text in templates.

Requirements

Installation

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',
            ],
        }
    },
]

Basic Use

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

License

This software is licensed under The MIT License (MIT). For more information, read the file LICENSE.

History

Forked in 2016 from the jingo-markdown project. Please see CHANGELOG for more history.

Releasing

  1. Update the version number in django_jinja_markdown/__about__.py.
  2. Add an entry to the change log in the README file.
  3. Tag the commit where you changed the above with the version number: e.g. 1.21.
  4. Push the commit and tag to the github repo.
  5. Create a new GitHub release, selecting the tag you just pushed to specify the commit. Hit Publish.
  6. Github will build and release the package to PyPI. Monitor the progress via the Actions tab.

About

Django-Jinja (Jinja2) extension and filter for parse markdown text markup.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%