Skip to content

WPI-LNL/django-easymde

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A markdown editor (with preview) for Django

Use a simple markdown editor https://github.com/Ionaru/easy-markdown-editor in django forms. This project is inspired by https://github.com/sparksuite/simplemde-markdown-editor and https://github.com/douglasmiranda/django-wysiwyg-redactor/.

Note that SimpleMDE is no longer in development, and has been forked to create EasyMDE, which is in active development as of mid-2024.

Getting started

  • install django-easymde
pip install django-easymde
  • add 'easymde' to INSTALLED_APPS.
INSTALLED_APPS = (
    # ...
    'easymde',
    # ...
)

Using field in models

from django.db import models
from easymde.fields import EasyMDEField

class Entry(models.Model):
    title = models.CharField(max_length=250, verbose_name=u'Title')
    content = EasyMDEField(verbose_name=u'mardown content')

Note: The widget EasyMDEWidget can also be used in forms on existing fields.

EasyMDE options

EasyMDE options can be set in settings.py:

EASYMDE_OPTIONS = {
    'placeholder': 'Type here...',
    'status': False,
    'autosave': {
        'enabled': True
    }
}

For the autosave option, this plugin will generate uniqueId with python's uuid.uuid4 automatically.

Right now, this plugin supports EasyMDE Configurations, but only the static ones(no support for javascript configurations such as previewRender)

Get EasyMDE instance from DOM

After EasyMDE is initialized, a EasyMDE instance can be retrieved from the DOM element:

$('.easymde-box')[0].EasyMDE

Packages

No packages published

Languages

  • Python 91.4%
  • JavaScript 6.0%
  • HTML 2.6%