Template filter¶
The rst_filter() filter is
deprecated. Keep it for existing templates that already use Django’s filter
syntax, but use Template tag for new template blocks.
See also
Setup¶
Add django_docutils to INSTALLED_APPS in your settings file:
INSTALLED_APPS = [
# ... your default apps,
"django_docutils"
]
Render filtered content¶
Important
The rst filter uses locked-down docutils defaults. See Security
before rendering user-authored RST or enabling trusted-content overrides.
In your HTML template:
{% load django_docutils %}
{% filter rst %}
hey
---
hi
##
A. hows
B. it
C. going
D. today
**hi**
*hi*
{% endfilter %}
Output:
<main id="hey">
<h1 class="title is-1">hey</h1>
<p class="subtitle" id="hi">hi</p>
<ol class="upperalpha simple">
<li><p>hows</p></li>
<li><p>it</p></li>
<li><p>going</p></li>
<li><p>today</p></li>
</ol>
<p><strong>hi</strong>
<em>hi</em></p>
</main>
Explore the API