Package: mezzanine-pagedown
Inspired bymezzanine-mdown,django-pagedown,
anddjango-markupmirror.This package provides rich text widgets and filters forMezzanineto author content using
Markdown syntax instead of the default TinyMCE editor.FeaturesUses thePageDownmarkdown
editor from Stack Exchange (optional), andPython-Markdownfor
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 customPython-Markdown
extensions,
and provides a few filters that are preconfigured to use some
extensions, such asMarkdown
Extra. If
server-side previews are enabled, configured extensions will be
enabled in the editor preview.HTML sanitizing usingBleach.
Bleach is already a dependency of Mezzanine.Integrates the editor’sInsert Imagebutton with Mezzanine’s file
browser (Media Library). Clicking theInsert Imagebutton pops up
an in-window selection dialog of Mezzanine’s Media Library.How to UseGet and install the package:pip install mezzanine-pagedownMezzanine 1.3 or higher is required.Install the app in your Mezzanine project by addingmezzanine_pagedownto the list ofINSTALLED_APPSin your
project’ssettings.py.Configure Mezzanine to use one of the provided rich text widgets. In
your project’ssettings.py, setRICHTEXT_WIDGET_CLASSto:'mezzanine_pagedown.widgets.PageDownWidget'to use the
PageDown editor with live preview.'mezzanine_pagedown.widgets.PlainWidget'to use a plain
textarea without preview.Configure Mezzanine to use one of the provided rich text filters for
rendering markdown content. Insettings.py, setRICHTEXT_FILTERSto 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 theCodeHiliteextension.'mezzanine_pagedown.filters.custom'to enable an explicit list
of extensions through thePAGEDOWN_MARKDOWN_EXTENSIONSsetting
(see below).Disable Mezzanine’s HTML sanitizing so that it does not interfere
with markdown’s blockquote syntax (>):RICHTEXT_FILTER_LEVEL = 3mezzanine-pagedown provides its own sanitizing after rendering
Markdown to HTML, and respects Mezzanine’sRICHTEXT_ALLOWED_TAGS,RICHTEXT_ALLOWED_ATTRIBUTES, andRICHTEXT_ALLOWED_STYLESsettings.(Optional): Server-side previews:Insettings.py, enable server-side live previews in the
editor:PAGEDOWN_SERVER_SIDE_PREVIEW = TrueBy default (False), previews are generated client-side using
PageDown’s previewer.Inurls.py, enable the preview URL:import mezzanine_pagedown.urlsThen add the following line tourlpatterns:("^pagedown/", include(mezzanine_pagedown.urls)),In this case, the preview URL is/pagedown/preview/. You can
replace"^pagedown/"with your own path.(Optional): Set enabled extensions. Requires thecustomfilter:RICHTEXT_FILTERS = ['mezzanine_pagedown.filters.custom']
PAGEDOWN_MARKDOWN_EXTENSIONS = ('extra','codehilite','toc')To use acustom
extension,
import it and include an instance in the list of extensions:from myapp.markdown_extensions.myextension import MyExtension
PAGEDOWN_MARKDOWN_EXTENSIONS = ('extra', MyExtension())(Optional): Generate and use a pygments CSS style for use with the
CodeHilite extension (requires installing pygments):python manage.py pygments_styles <scheme_name>LicenseLicence: BSD. See includedLICENSEfile.Note that this license applies to this repository only. ThePageDownJavaScript library is
used as a sub-repository and has its own license.