Skip to main content
To quote Richard Stallman, lo these many years ago, "What you see is what you get" == ""What you see is all there is!".
This plugin does not replace the standard CMS text plugin, it is a new plugin class, Markdown.

Home-page: https://github.com/bobhy/cmsplugin-markdownx
Author: Bob Hyman
Author-email: bob.hyman@bobssoftwareworks.com
License: MIT License
Description: Shims the estimable [django-markdownx](https://github.com/adi-/django-markdownx) into the venerable [django-cms](https://github.com/divio/django-cms).
Provides a `Markdown` plugin for Django-cms which stores content in markdown but displays as HTML.
We consider it an advantage that the rendering is all done server-side,
that ensures the editing preview looks
just like the final result in case we do preprocessing enhancements for the markdown dialect.


* [Quick Start](#quick-start)
* [Usage](#usage)
* [Customization](#customization)
* [Dependencies](#dependencies)
* [License](#license)
* [Changelog](#changelog)


# Quick Start

1. Install prerequisites, then `cmsmarkdown-markdownx` package.

```bash
pip install django-markdownx
pip install cmsmarkdown-markdownx

1. Add `cmsplugin_markdownx` to your `INSTALLED_APPS`.

```python
#settings.py
INSTALLED_APPS = (
...
'markdownx',
'cmsplugin_markdownx',
)
```

1. Refer to [#customization] for additional settings you probably want to use.

1. Add django-markdownx`s urls: (*not* in `il8n_patterns()`)

```python
#urls.py
urlpatterns = [
[...]
url(r'^markdownx/', include('markdownx.urls')),
]```

1. Collect included templates and statics to your `STATIC_ROOT` folder.

```bash
python manage.py collectstatic
```

# Usage

1. in CMS, edit a page with a placeholder.
1. Add a `Markdown` plugin
1. As you type, the preview window is updated (thank you @django-markdownx)

From the 'frontend' view, you can update the plugin content.

1. Be sure you're logged into CMS, with adequate privilees.
1. Browse to a page containing Markdown
1. Double-click on the section of the page containing the Markdown plugin.


# Customization

## Settings

Place settings in your `settings.py` to override default values:

```python
#settings.py

## for django-markdownx (see https://github.com/adi-/django-markdownx#customization)

# Markdownify
MARKDOWNX_MARKDOWNIFY_FUNCTION = 'markdownx.utils.markdownify'

# Markdown extensions
MARKDOWNX_MARKDOWN_EXTENSIONS = [
'markdown.extensions.extra',
'markdown.extensions.codehilite', ## wants Pygments
]

# specify the code highlighting stylesheet used by `markdown.extensions.codehilite`
CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS = 'cmsplugin_markdownx/codehilite_colorful.css'
```

## Template Tags

If you want to design your own template to display rendered HTML from Markdown text, you need to do 2 things:

1. Include the CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS stylesheet in the CSS section of the page header.
1. Run the markdown text from some instance of the Markdown plugin through the MARKDOWNX_MARKDOWNIFY_FUNCTION you configured for `django-markdownx'

In order to do any or all of the above, you must load the template tags first.

```html+django
{% load cmsplugin_markdownx %}
```

### Custom tag `{% get_settings _settingsVariable_ default=None %}`
This tag extracts the value of _settingsVariable_ from your site `settings.py`. You can specify the default value to use if it is not defined.

This tag is not dependent on markdown processing, it can be used in other apps and projects.

### Filter `{{ ... |markdownify }}`
Converts the markdown text provided by its left-hand argument into HTML using `django-markdownx`'s `MARKDOWNX_MARKDOWNIFY_FUNCTION`

The HTML blob itself does not have a `<div`> wrapper, leaving you free to style one in the template.

### Example

```html_django
{% load static sekizai_tags cmsplugin_markdownx %}
{% get_setting "CMSPLUGIN_MARKDOWNX_CODEHILITE_CSS" as codehilite_css %}
{% if codehilite_css %}
{% addtoblock "css" %}
<link rel="stylesheet" href="{% static codehilite_css %}"/>
{% endaddtoblock %}
{% endif %}

<div>{{ instance.markdown_text|markdownify }}</div>
```

# Dependencies

* Markdown
* Pillow
* Django
* jQuery


# License

cmsplugin-markdown is licensed under the MIT open source license. Read `LICENSE` file for details.

# Changelog

| version | date | notes |
| :---------: | :-------: | -------------------------- |
| 0.1 | Jan 29, 2017 | Initial release |




Keywords: django,django-cms,plugin,markdown,editor
Platform: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.10
Classifier: Framework :: Django :: 1.9
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Text Processing :: Markup

Metadata

Release files for cmsplugin-markdownx 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmsplugin-markdownx 0.1.3
File Size Uploaded Provenance Actions
cmsplugin-markdownx-0.1.3.tar.gz 8.2 kB Without provenance Details for cmsplugin-markdownx-0.1.3.tar.gz

Release files / cmsplugin-markdownx-0.1.3.tar.gz

Download URL cmsplugin-markdownx-0.1.3.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4a34f6aba4569982a1f00a91dbd74b890fa84d2c5355dd7fd6827238282faa13
BLAKE2b-256 checksum
How to use checksums
d87e4079c0e24e4f91587d361805e9b8f534ced25e6fcd1e22dc682e0e474dcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cmsplugin-markdownx 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page