skillfed

django-markdownify

Markdown template filter for Django.

django-markdownify v0.9.7 154.7K downloads/30d#10,846 on PyPI130
Permissive license MIT Active released

What it is and what it does

Django Markdownify is a template filter that processes Markdown syntax into HTML within Django templates, automatically sanitizing the output using bleach to prevent injection attacks. It wraps the markdown and bleach libraries, allowing you to write `{{ text|markdownify }}` in templates to render user-supplied or content-managed Markdown safely.

The package supports multiple configuration profiles, so you can define different whitelist tags and markdown extensions for different use cases—for example, one profile for user comments (restrictive) and another for documentation (permissive). Settings are defined in Django's settings.py and referenced by name in templates. It has been maintained since 2016 and remains actively developed.

Use it for:

  • Render user-submitted comments or forum posts as HTML while restricting dangerous tags and scripts.
  • Display documentation or help text written in Markdown within Django admin or frontend templates.
  • Convert content-managed Markdown fields (e.g., from a CMS) to HTML with site-specific tag whitelists.
  • Build blog or news sites where authors write in Markdown and the template layer handles HTML conversion.
  • Sanitize Markdown from external APIs or feeds before displaying in Django templates.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A Django template filter that converts Markdown text to sanitized HTML, wrapping the markdown and bleach libraries for safe rendering in templates.

Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and solves a common Django need—rendering Markdown safely in templates. No known vulnerabilities and a stable dependency set make it a straightforward choice for projects that need template-level Markdown conversion.

Install

django-markdownify on PyPI

pip

pip install django-markdownify

uv

uv add django-markdownify

poetry

poetry add django-markdownify

Installing django-markdownify

Before you install

Low friction install with three straightforward runtime dependencies (Django, markdown, bleach). Active maintenance with a recent release in May 2026 and consistent repository activity.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

# In Django settings.py, configure if needed:
MARKDOWNIFY = {"default": {"WHITELIST_TAGS": ["a", "p"]}}

# In your template:
{% load markdownify %}
{{ mytext|markdownify }}

# Or with an alternative configuration:
{{ mytext|markdownify:"alternative" }}

Requires Django to be installed and configured; the filter only works within Django template contexts.

Verify before relying

  • Whether the package handles edge cases in markdown-to-HTML conversion beyond what markdown and bleach provide by default
  • Performance characteristics when processing large volumes of markdown text in templates

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 3 — Django, markdown, bleach
Maintenance actively maintained — 88 days since the last release
Last repo commit
First released
Downloads 154,728/month — #10,846 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_markdownify-0.9.7-py3-none-any.whl

Environment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersOperating System :: OS Independent

Tags

django markdown to html filtermarkdown template filter djangoconvert markdown html django templatessanitized markdown rendering djangobleach markdown django integration
django-templatesmarkdown-renderinghtml-sanitization

More HTML packages