Installation¶
Requirements¶
- Python 3.11+
- Django 5.2+
Install the Package¶
Add to Django Settings¶
Include URLs¶
The editor needs two endpoints: one for server-side preview and one for file uploads.
# urls.py
from django.urls import include, path
urlpatterns = [
...
path("md-editor/", include("django_markdown_widget.urls")),
]
Optional: Install a Markdown Library¶
The default renderer uses python-markdown for server-side rendering. If it's not installed, the renderer falls back to escaped plaintext.
Note
Client-side preview always works -- it uses the bundled marked.js library. The server-side renderer is used by the {% markdown %} template tag and the preview API endpoint.
Verify¶
Start your development server and add a MarkdownEditorWidget to any form. You should see the editor with a toolbar, write/preview tabs, and a footer.