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.4.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_markdown_editor_next-0.4.tar.gz
Algorithm Hash digest
SHA256 e4c67fbccd16edd0fe09179452861b44d5cbf7a56c89ac768f5aa7195ca883bf
MD5 6a49a05ccba83508de522cf60218f526
BLAKE2b-256 44df04290cfb3e7f1dcce5a68bfa15c32d4fb882fa68da74bc644510db79fc5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_markdown_editor_next-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9bcbbef65aa37111d3a75a664c1c03dbdd1b1a28aa229fa6091969858c8aab47
MD5 1c8451566949ccefc6099ff79d172a08
BLAKE2b-256 76e5bf6ccadbd650d60a690b5b435304c049ad942220f9e3fdd200667834af75

See more details on using hashes here.

Supported by

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