Skip to main content
Help us improve Python packaging – donate today!

PageDown rich text widget for Mezzanine

Project Description

Inspired by mezzanine-mdown, django-pagedown, and django-markupmirror.

This package provides rich text widgets and filters for Mezzanine to author content using Markdown syntax instead of the default TinyMCE editor.

Features

  • Uses the PageDown markdown editor from Stack Exchange (optional), and Python-Markdown for rendering.
  • Supports client-side and server-side live previews in the editor. Client-side previews use PageDown’s JavaScript previewer. Server-side previews use the same rendering filter as the final page.
  • Supports bundled and custom Python-Markdown extensions, and provides a few filters that are preconfigured to use some extensions, such as Markdown Extra. If server-side previews are enabled, configured extensions will be enabled in the editor preview.
  • HTML sanitizing using Bleach. Bleach is already a dependency of Mezzanine.
  • Integrates the editor’s Insert Image button with Mezzanine’s file browser (Media Library). Clicking the Insert Image button pops up an in-window selection dialog of Mezzanine’s Media Library.

How to Use

  1. Get and install the package:

    pip install mezzanine-pagedown
    

    Mezzanine 1.3 or higher is required.

  2. Install the app in your Mezzanine project by adding mezzanine_pagedown to the list of INSTALLED_APPS in your project’s settings.py.

  3. Configure Mezzanine to use one of the provided rich text widgets. In your project’s settings.py, set RICHTEXT_WIDGET_CLASS to:

    • 'mezzanine_pagedown.widgets.PageDownWidget' to use the PageDown editor with live preview.
    • 'mezzanine_pagedown.widgets.PlainWidget' to use a plain textarea without preview.
  4. Configure Mezzanine to use one of the provided rich text filters for rendering markdown content. In settings.py, set RICHTEXT_FILTERS to include one of the following:

    • 'mezzanine_pagedown.filters.plain' to use plain Markdown syntax with no extensions.
    • 'mezzanine_pagedown.filters.extra' to use Markdown Extra.
    • 'mezzanine_pagedown.filters.codehilite' to enable the CodeHilite extension.
    • 'mezzanine_pagedown.filters.custom' to enable an explicit list of extensions through the PAGEDOWN_MARKDOWN_EXTENSIONS setting (see below).
  5. Disable Mezzanine’s HTML sanitizing so that it does not interfere with markdown’s blockquote syntax (>):

    RICHTEXT_FILTER_LEVEL = 3
    

    mezzanine-pagedown provides its own sanitizing after rendering Markdown to HTML, and respects Mezzanine’s RICHTEXT_ALLOWED_TAGS, RICHTEXT_ALLOWED_ATTRIBUTES, and RICHTEXT_ALLOWED_STYLES settings.

  6. (Optional): Server-side previews:

    • In settings.py, enable server-side live previews in the editor:

      PAGEDOWN_SERVER_SIDE_PREVIEW = True
      

      By default (False), previews are generated client-side using PageDown’s previewer.

    • In urls.py, enable the preview URL:

      import mezzanine_pagedown.urls
      

      Then add the following line to urlpatterns:

      ("^pagedown/", include(mezzanine_pagedown.urls)),
      

      In this case, the preview URL is /pagedown/preview/. You can replace "^pagedown/" with your own path.

  7. (Optional): Set enabled extensions. Requires the custom filter:

    RICHTEXT_FILTERS = ['mezzanine_pagedown.filters.custom']
    PAGED
    

Release history Release notifications

This version
History Node

1.1

History Node

1.0

History Node

0.9

History Node

0.8

History Node

0.7

History Node

0.6

History Node

0.5

History Node

0.3

History Node

0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
mezzanine_pagedown-1.1-py2-none-any.whl (66.5 kB) Copy SHA256 hash SHA256 Wheel py2 Apr 7, 2018
mezzanine-pagedown-1.1.tar.gz (63.0 kB) Copy SHA256 hash SHA256 Source None Apr 7, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page