Markdown editor widget for Django Unfold admin
Project description
Django Unfold Markdown Widget
Markdown editor widget for Django Unfold admin using EasyMDE.
Screenshots
Editor with Preview
Fullscreen Mode
Editor inside tab and Dark theme
Features
- Plain text editor with monospace font
- Side-by-side preview and fullscreen modes
- Dark/light theme integration with Unfold
- Material Symbols icons matching Unfold design
- Toolbar: bold, italic, strikethrough, headings, lists, links, images, tables, horizontal rules
- No autosave (saves on form submit)
- Responsive design
Installation
pip install django-unfold-markdown
Configuration
Add to your INSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
"unfold",
"unfold_markdown", # Add this
# ...
]
Usage
For all TextField fields
# admin.py
from django.db import models
from unfold.admin import ModelAdmin
from unfold_markdown.widgets import MarkdownWidget
@admin.register(Article)
class ArticleAdmin(ModelAdmin):
formfield_overrides = {
models.TextField: {"widget": MarkdownWidget}
}
For specific fields
from django import forms
from unfold_markdown.widgets import MarkdownWidget
class ArticleForm(forms.ModelForm):
content = forms.CharField(widget=MarkdownWidget())
class Meta:
model = Article
fields = '__all__'
@admin.register(Article)
class ArticleAdmin(ModelAdmin):
form = ArticleForm
Storage and Rendering
The widget stores pure Markdown text in your database. To render Markdown as HTML, use a Python library:
# Using markdown
from markdown import markdown
html = markdown(article.content)
# Using mistune
import mistune
html = mistune.html(article.content)
Requirements
- Python ≥ 3.10
- Django ≥ 4.2
- django-unfold ≥ 0.70.0
License
MIT License
Repository
https://github.com/sergei-vasilev-dev/django-unfold-markdown
Credits
- EasyMDE: Ionaru/easy-markdown-editor (MIT License)
- Django Unfold: unfoldadmin/django-unfold (MIT License)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_unfold_markdown-0.1.2.tar.gz.
File metadata
- Download URL: django_unfold_markdown-0.1.2.tar.gz
- Upload date:
- Size: 117.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b4d8c627c08901fc6088a4aa85c357510fa4c9e55fcb2e81f2bdf10628076ec
|
|
| MD5 |
bda3146e0e310e3f4e58a692030e3fd0
|
|
| BLAKE2b-256 |
fbc53d1e9d43fce9a0b646bf4f40fdce056af45cda39ede35a2d1cdebfb25ddc
|
File details
Details for the file django_unfold_markdown-0.1.2-py3-none-any.whl.
File metadata
- Download URL: django_unfold_markdown-0.1.2-py3-none-any.whl
- Upload date:
- Size: 119.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9614d7eac13c0b6be1288dfe7750987cbb99810372803a880b90b07ee014ce0
|
|
| MD5 |
3097b4b0eb5b4d1e8eafb5a6028226aa
|
|
| BLAKE2b-256 |
da6dc4ded7b49db7e4c8daddafb28b6ec377a5e435879e370e048537342e65c3
|