Skip to main content

Restructured Text plugin for Django CMS.

Project description

A plugin for Django CMS, which renders restructured text into html, using docutils.


Install cmsplugin_rst using pip or your favorite method, using a virtualenv or not.

$ pip install cmsplugin_rst

Add 'cmsplugin_rst' to your INSTALLED_APPS, in your django settings.

And then migrate the DB:

$ python migrate

Beware, if you upgrade from cmsplugin_rst v0.1.1, which didn’t use django migrations but South, you may have to skip the initial migration (eg. if you get the “OperationalError: table “cmsplugin_rst_rstpluginmodel” already exists” error):

$ python migrate –fake-initial cmsplugin_rst

To speed up the (potentially heavy) rendering of cmsplugin_rst plugins, consider using the cache framework of django.


The behaviour of cmsplugin_rst can be tweaked with these Django settings (all are optional).

The plugin disallows, by default, insecure features like *file insertions* and *raw* directive, in the restructured text renderer.

Name of the docutils writer to be used for rendering HTML (default: “html4css1”)
A restructuredtext string wich will be prepended to all your RST plugin contents, before rendering. Useful to define replacement blocks, custom roles, etc.
A restructuredtext string wich will be appended to all your RST plugin contents, before rendering.
A dict of settings which will be merged over plugin defaults, and passed to the docutils renderer. See docutils publish_parts() and its settings_overrides parameter ( Amongst interesting settings are “initial_header_level” and “report_level”.
If and only if BeautifulSoup is installed, these postprocessors are applied to the rendered HTML before displaying it. It must be a list of qualified function names, eg. [“mymodule.mysubmodule.myfunction”]. Each of these functions must expect a beautifulsoup tree as unique argument, and modify it in-place.

Specific Roles and Replacements

The restructured text is not evaluated by the django template engine, so you can’t use django/djangocms tags and filters.

But some specific replacements take place:

  • {{ MEDIA_URL }} and {{ STATIC_URL }} tags are replaced, before html rendering, by corresponding django settings.
  • {{ BR }} and {{ NBSP }} are replaced, after html rendering, by corresponding html tags/entities.

Additionally, you can create links to other CMS pages with the custom “cmspage” role provided, using the “reverse IDs” that you’ll have set previously in advanced page parameters:

:cmspage:`My-Reverse-Id`   // the menu title will be use as the link name

:cmspage:`My Link Name <My-Reverse-Id>`   // here the link name is embedded in role

Reverse IDs must exist and be unique in the djangocms DB, else the rendering of the link fails.

Test Project

A demo project with a sqlite DB is included in repository, as a git submodule (

Its django admin credentials are test/test.

Project details

Download files

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

Files for cmsplugin-rst, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size cmsplugin-rst-0.2.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View
Filename, size (11.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page