Skip to main content

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

Project description

https://github.com/mozmeao/django-jinja-markdown/actions/workflows/ci.yaml/badge.svg https://img.shields.io/pypi/v/django-jinja-markdown.svg

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 pyproject.toml.

  2. Add an entry to the CHANGELOG file.

  3. Tag the commit 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.

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

django_jinja_markdown-1.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_jinja_markdown-1.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file django_jinja_markdown-1.2.tar.gz.

File metadata

  • Download URL: django_jinja_markdown-1.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for django_jinja_markdown-1.2.tar.gz
Algorithm Hash digest
SHA256 f109ce81e3655c43a4df0e482f3de839e18f96fecaf7032c415a49a15fde13c4
MD5 aaf345cc5eb63e100598681313338aac
BLAKE2b-256 6aba8bc33dfd8644c00262d17e4091561e627feac540b73de3221e9152701974

See more details on using hashes here.

File details

Details for the file django_jinja_markdown-1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_jinja_markdown-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58cb4f0f87c7ef216865ff81df209a2aec8afb28451ee5c4aba3a0962da56f88
MD5 5b4c99ae9428c2f0091309dd1242d81b
BLAKE2b-256 45dc0449a46eeff79c08e78c8ed8597335c98930d16fa256e6598602a05955b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page