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.3.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.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_markdown_editor_next-0.3.tar.gz
Algorithm Hash digest
SHA256 9af71636ef77af2766756997ec69c8aa741d3f78b6c7665f3b1865c5e90f2550
MD5 f8eff3e470bf78a506c91dbdd0034a92
BLAKE2b-256 dce97192c278a3a7563abf547927b30cb975652a692d3ea862c4b5bc0159254d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_markdown_editor_next-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a80ab64df9439396dd20e098f84d5473dd83f4a351aab5594252d03b91521f54
MD5 b4d0d89cc883a5f292385f2d978386c4
BLAKE2b-256 eb175b3603e7b981e291621bfe4a057cb363ef8c220361fc8e0fac87f1088d73

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