Skip to main content

Django markdown support and wysiwyg.

Project description

Django-Markdown v. 0.9.7

Django markdown is django application that allows use markdown wysiwyg in flatpages, admin forms and other forms. Documentaton available at readthedocs or github.

https://circleci.com/gh/sv0/django-markdown-app.svg?style=svg Coverals Version License

Requirements

  • django >= 2.0, <3.0

  • markdown >= 2.6.11

Installation

Django markdown should be installed using pip:

pip install django-markdown-app

Version compatibility

Django version

django-markdown-app

2.0 - 2.2

0.9.7

2.0 - 2.1

0.9.6

1.8 or later

0.9.3.1

prior to 1.8

0.8.5.1

Setup

  • Add ‘django_markdown’ to INSTALLED_APPS

    INSTALLED_APPS += ( 'django_markdown', )
  • Add django_markdown urls to base urls

    path('markdown/', include( 'django_markdown.urls')),

Use django_markdown

  1. Models:

    from django_markdown.models import MarkdownField
    
    
    class MyModel(models.Model):
        content = MarkdownField()
  2. Custom forms:

    from django_markdown.fields import MarkdownFormField
    from django_markdown.widgets import MarkdownWidget
    
    
    class MyCustomForm(forms.Form):
        content = forms.CharField(widget=MarkdownWidget())
        content2 = MarkdownFormField()
  3. Custom admins:

    from django_markdown.admin import MarkdownModelAdmin
    
    admin.site.register(MyModel, MarkdownModelAdmin)
  4. Admin Overrides: (If you don’t want to subclass package ModelAdmin’s)

    from django.contrib import admin
    
    class YourModelAdmin(admin.ModelAdmin):
        formfield_overrides = {MarkdownField: {'widget': AdminMarkdownWidget}}
  5. Flatpages:

    # in your project main urls
    from django_markdown import flatpages
    ...
    # Django admin
    admin.autodiscover()
    flatpages.register()
    urlpatterns += [ path(r'admin/', admin.site.urls), ]
  6. Template tags:

    <textarea name="test" id="new"></textarea>
    {% markdown_editor "#new" %}
    {% markdown_media %}

Settings

MARKDOWN_EDITOR_SETTINGS - holds the extra parameters set to be passed to textarea.markItUp()

MARKDOWN_EDITOR_SKIN - skin option, default value is markitup

Example: settings.py

MARKDOWN_EDITOR_SKIN = 'simple'

MARKDOWN_EXTENSIONS - optional list of extensions passed to Markdown.

Officially supported extensions could be found at https://python-markdown.github.io/extensions/#officially-supported-extensions

Example: settings.py

MARKDOWN_EXTENSIONS = ['extra']

MARKDOWN_EXTENSION_CONFIGS - configure extensions

MARKDOWN_PREVIEW_TEMPLATE - template for preview a markdown. By default django_markdown/preview.css

MARKDOWN_STYLE - path to preview styles. By default django_markdown/preview.css

MARKDOWN_SET_PATH - path to folder with sets. By default django_markdown/sets

MARKDOWN_SET_NAME - name for current set. By default markdown.

MARKDOWN_PROTECT_PREVIEW - protect preview url for staff only

Examples

Execute make run in sources directory. Open http://127.0.0.1:8000 in your browser. For admin access use ‘root:root’ credentials.

Changes

Make sure you’ve read the changes document if you are upgrading from previous version.

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/sv0/django-markdown-app/issues

Contributing

Development of django-markdown happens at github: https://github.com/sv0/django-markdown-app

All changes should include tests, pass flake8 and pass build on the TravisCI

Contributors

License

Licensed under a GNU lesser general public license.

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-app-0.9.7.tar.gz (78.9 kB view details)

Uploaded Source

Built Distribution

django_markdown_app-0.9.7-py2.py3-none-any.whl (97.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-markdown-app-0.9.7.tar.gz.

File metadata

  • Download URL: django-markdown-app-0.9.7.tar.gz
  • Upload date:
  • Size: 78.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for django-markdown-app-0.9.7.tar.gz
Algorithm Hash digest
SHA256 d73ab0753d62e2d9de9a009c1d2a2526efe974515d2c5ac45654df689c757602
MD5 a3064f44ce00b9e598e00425bcc2a58a
BLAKE2b-256 77259be320e799346920634605ada422210a31344be61ba2a4a268a798d0bd19

See more details on using hashes here.

File details

Details for the file django_markdown_app-0.9.7-py2.py3-none-any.whl.

File metadata

  • Download URL: django_markdown_app-0.9.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 97.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for django_markdown_app-0.9.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d33d02c55690e33b4cc2694040d4df048927d5cb83a16102cb023ef84c0893e6
MD5 801b425cf5a7875df867356038e7913e
BLAKE2b-256 10c1fa612eba77921a40366aa367ff34a8158c4abad3593bed1b72ea749078ef

See more details on using hashes here.

Supported by

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