A Django package to support Markdown text editor in Django admin
Project description
Django Markdown Editor Next
An advanced Markdown editor for Django admin with real-time preview, image uploads, and customizable toolbar. This package extends and improves upon existing Django Markdown editors.
Installation
pip install django-markdown-editor-next
Setup
-
Add 'django_markdown_editor_next' to your INSTALLED_APPS setting.
-
Add the following to your project's urls.py:
from django.urls import path, include urlpatterns = [ # ... your other url patterns path('markdown-editor-next/', include('django_markdown_editor_next.urls')), ]
-
Ensure your
MEDIA_ROOT
andMEDIA_URL
settings are configured in your Django settings:MEDIA_ROOT = BASE_DIR / 'media' MEDIA_URL = '/media/'
-
In your models, use the MarkdownField:
from django_markdown_editor_next.fields import MarkdownField class MyModel(models.Model): content = MarkdownField()
Features
- Real-time Markdown preview
- Image uploads with drag-and-drop support
- Customizable toolbar
- Keyboard shortcuts
- Syntax highlighting for code blocks
- Emoji picker
Customizing the Toolbar
You can customize the toolbar buttons when defining your model field:
content = MarkdownField(
custom_toolbar=[
{'action': 'bold', 'icon': 'fas fa-bold', 'title': 'Bold'},
{'action': 'italic', 'icon': 'fas fa-italic', 'title': 'Italic'},
{'action': 'link', 'icon': 'fas fa-link', 'title': 'Link'},
{'action': 'image', 'icon': 'fas fa-image', 'title': 'Image'},
{'action': 'preview', 'icon': 'fas fa-eye', 'title': 'Toggle Preview'},
{'action': 'emoji', 'icon': 'fas fa-smile', 'title': 'Insert Emoji'}
]
)
Keyboard Shortcuts
- Ctrl/Cmd + B: Bold
- Ctrl/Cmd + I: Italic
- Ctrl/Cmd + K: Insert Link
- Ctrl/Cmd + Shift + C: Insert Code Block
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
File details
Details for the file django_markdown_editor_next-0.5.tar.gz
.
File metadata
- Download URL: django_markdown_editor_next-0.5.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f2af96db47bf8e649c466abbc7140e65a94e4fe5457b9fdfe3838d13a9ce4bb2
|
|
MD5 |
cfd9a875a8928374e248553455c3affe
|
|
BLAKE2b-256 |
854020b43915d424145310ca8e3ce95594fa155abfd9a97d59566815081c8811
|
File details
Details for the file django_markdown_editor_next-0.5-py3-none-any.whl
.
File metadata
- Download URL: django_markdown_editor_next-0.5-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
130c43bd82d7de3e00f5161566e308ab141b4a097bba2bb3ab9cfe04b75eb26a
|
|
MD5 |
dcb0b508d3400bdacaf824720c1b2335
|
|
BLAKE2b-256 |
f9a9705738591718cd3d458cedad4e9a5f677038555cbdc14d110d920282cebd
|