Skip to main content

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

  1. Add 'django_markdown_editor_next' to your INSTALLED_APPS setting.

  2. 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')),
    ]
    
  3. Ensure your MEDIA_ROOT and MEDIA_URL settings are configured in your Django settings:

    MEDIA_ROOT = BASE_DIR / 'media'
    MEDIA_URL = '/media/'
    
  4. 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

django_markdown_editor_next-0.5.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

django_markdown_editor_next-0.5-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file django_markdown_editor_next-0.5.tar.gz.

File metadata

File hashes

Hashes for django_markdown_editor_next-0.5.tar.gz
Algorithm Hash digest
SHA256 f2af96db47bf8e649c466abbc7140e65a94e4fe5457b9fdfe3838d13a9ce4bb2
MD5 cfd9a875a8928374e248553455c3affe
BLAKE2b-256 854020b43915d424145310ca8e3ce95594fa155abfd9a97d59566815081c8811

See more details on using hashes here.

File details

Details for the file django_markdown_editor_next-0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_markdown_editor_next-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 130c43bd82d7de3e00f5161566e308ab141b4a097bba2bb3ab9cfe04b75eb26a
MD5 dcb0b508d3400bdacaf824720c1b2335
BLAKE2b-256 f9a9705738591718cd3d458cedad4e9a5f677038555cbdc14d110d920282cebd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page