Skip to main content

djangocms-markdown

PyPI Python Version Django Version django CMS Version codecov

A markdown content plugin and model field for django CMS. Write content in Markdown using an integrated editor and have it rendered as HTML on your site.

Attention: Version 0.3.2 is from a different project by the great Nicolas Noé. This project is an entirely different rewrite with different goals.

Features

  • MDText CMS plugin — add markdown content to any django CMS placeholder
  • MarkdownField — a model field for storing markdown in your own models, with a .rendered property that returns HTML
  • EasyMDE editor — a full-featured markdown editor with toolbar, preview, and side-by-side mode in the admin and CMS plugin forms
  • Dynamic object references — link to any Django object with [text](ref:app.model:pk) syntax; URLs are resolved at render time so they stay up to date. When an object is deleted, the link is replaced with plain text.
  • Inline reference picker — when the cursor is inside a markdown link, a select2 autocomplete popup appears above the link, allowing you to search and select internal pages or objects. Requires djangocms-link or a custom autocomplete endpoint. If the link text is empty it is filled with the selected object's name.
  • Template filter — {{ value|render_markdown }} for rendering markdown anywhere in templates
  • Configurable rendering — uses Python-Markdown with sensible defaults (tables, fenced code, syntax highlighting, TOC, and more)

Installation

pip install djangocms-markdown

Add djangocms_markdown to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...,
    "djangocms_markdown",
]

Run migrations:

python manage.py migrate djangocms_markdown

Usage

CMS plugin

After installation the Markdown plugin is available in the plugin picker under the Generic module. Add it to any placeholder and write markdown in the editor. The content is rendered to HTML on save and displayed on the page.

MarkdownField (models)

Use MarkdownField in your own models just like a TextField:

from django.db import models
from djangocms_markdown.fields import MarkdownField


class Article(models.Model):
    body = MarkdownField()

The field stores raw markdown. Access the rendered HTML through the .rendered property:

article = Article.objects.get(pk=1)
str(article.body)           # raw markdown
article.body.rendered       # rendered HTML (marked safe)

In admin forms the field automatically uses the EasyMDE markdown editor.

Template filter

{% load djangocms_markdown_tags %}

{{ article.body|render_markdown }}

Configuration

All settings are optional.

  • DJANGOCMS_MARKDOWN_EXTENSIONS — list of Python-Markdown extensions to enable. Default:

    DJANGOCMS_MARKDOWN_EXTENSIONS = [
        "markdown.extensions.extra",
        "markdown.extensions.codehilite",
        "markdown.extensions.toc",
        "markdown.extensions.sane_lists",
    ]
    
  • DJANGOCMS_MARKDOWN_EXTENSION_CONFIGS — dict of extension-specific configuration. Default:

    DJANGOCMS_MARKDOWN_EXTENSION_CONFIGS = {
        "markdown.extensions.codehilite": {
            "css_class": "highlight",
            "guess_lang": False,
        },
    }
    
  • DJANGOCMS_MARKDOWN_PLUGIN_NAME — display name of the CMS plugin. Default: "Markdown"

  • DJANGOCMS_MARKDOWN_PLUGIN_MODULE_NAME — module name the plugin appears under in the plugin picker. Default: "Generic"

  • DJANGOCMS_MARKDOWN_TABLE_CLASS — CSS class(es) added to every <table> tag in rendered HTML. Useful for Bootstrap ("table") or other CSS frameworks. Set to "" to disable. Default: "table"

  • DJANGOCMS_MARKDOWN_EASYMDE_CDN_BASE — CDN base URL for loading the EasyMDE editor. Set to "" to serve from your own static files instead. Default: "https://cdn.jsdelivr.net/npm/easymde@2.20.0/dist"

Rendered HTML is sanitized with nh3 using the same settings as djangocms-text:

  • TEXT_HTML_SANITIZE — set to False to disable sanitization (default True)
  • TEXT_ADDITIONAL_TAGS — extra HTML tags to allow
  • TEXT_ADDITIONAL_ATTRIBUTES — extra attributes to allow per tag
  • TEXT_ADDITIONAL_PROTOCOLS — extra URL schemes to allow

Contributing

git clone https://github.com/fsbraun/djangocms-markdown.git
cd djangocms-markdown
python -m venv .venv
source .venv/bin/activate
pip install -e ".[test]"
pytest

License

BSD-3-Clause

Metadata

Release files for djangocms-markdown 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangocms-markdown 1.0.1
File Size Uploaded
djangocms_markdown-1.0.1.tar.gz 29.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djangocms-markdown 1.0.1
File Interpreter ABI Platform
djangocms_markdown-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.1 kB

Release files / djangocms_markdown-1.0.1.tar.gz

Download URL djangocms_markdown-1.0.1.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5c4b8dbf4a1d95983d6aedeee4d0fe7b77e3657a36a03aaa6adc5eb0c8d61774
BLAKE2b-256 checksum
How to use checksums
c504061bfb07b38f78001289353842802bba584f7ee264c460f37c8fdf1a646a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.

Transparency log

Release files / djangocms_markdown-1.0.1-py3-none-any.whl

Download URL djangocms_markdown-1.0.1-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50f01a7b79ace39b31da583af923f85aa2c27331f5ae4c2ce6caefbde264e21f
BLAKE2b-256 checksum
How to use checksums
33901dd629ecf9400ab00df739e5304296e4f12fdbd2f2cb1cf37436cebdb29d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page