Skip to main content

A Django package to support Markdown text editor in Django admin

Project description

Django Markdown Editor

A feature-rich Markdown editor for Django admin with real-time preview, image uploads, and customizable toolbar.

Installation

pip install django-markdown-editor

Setup

  1. Add 'django_markdown_editor' 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/', include('django_markdown_editor.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.fields import MarkdownField
    
    class MyModel(models.Model):
        content = MarkdownField()
    

Features

  • Real-time Markdown preview
  • Image uploads
  • Customizable toolbar
  • Keyboard shortcuts

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'}
    ]
)

Keyboard Shortcuts

  • Ctrl/Cmd + B: Bold
  • Ctrl/Cmd + I: Italic
  • Ctrl/Cmd + K: Insert Link

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.2.tar.gz (7.4 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.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_markdown_editor_next-0.2.tar.gz
Algorithm Hash digest
SHA256 a1c63501648ded86f56c28249cd286e8856a263b4e9813fe1edf2b0ed7045d83
MD5 8d9d3f7232865e711d230b420ad374b0
BLAKE2b-256 e32d1f655813cebc277e432b17ca5c2941ce4fecc5ad1e015a710ca64d418a1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_markdown_editor_next-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 614239980fd39633f920f37a95ef58a49459b6a77499bff3d51d246a05216dc3
MD5 6e3d50f21f0614a52bdd14232bb6138a
BLAKE2b-256 e47a837ae10603098954a06e27fc34594037568893c9e11d1e6bb96b286f31fd

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