# django-docutils · [](https://pypi.org/project/django-docutils/) [](https://github.com/tony/django-docutils/blob/master/LICENSE)
docutils (a.k.a. reStructuredText / rst / reST) support for Django.
## Quickstart
Install django-docutils:
```console
$ pip install django-docutils
```
Next, add `django_docutils` to your `INSTALLED_APPS` in your settings file:
```python
INSTALLED_APPS = [
# ... your default apps,
'django_docutils'
]
```
## Template tag
In your template:
```django
{% load django_docutils %}
{% rst %}
# hey
# how's it going
A. hows
B. it
C. going
D. today
**hi**
*hi*
{% endrst %}
```
## Template filter
In your template:
```django
{% load django_docutils %}
{% filter rst %}
# hey
# how's it going
A. hows
B. it
C. going
D. today
**hi**
*hi*
{% endfilter %}
```
## Template engine (class-based view)
You can also use a class-based view to render reStructuredText (reST).
If you want to use reStructuredText as a django template engine, `INSTALLED_APPS` _isn't_ required,
instead you add this to your `TEMPLATES` variable in your settings:
```python
TEMPLATES = [
# ... Other engines
{
"NAME": "docutils",
"BACKEND": "django_docutils.template.DocutilsTemplates",
"DIRS": [],
"APP_DIRS": True,
}
]
```
Now django will be able to scan for .rst files and process them. In your view:
```python
from django_docutils.views import DocutilsView
class HomeView(DocutilsView):
template_name = 'base.html'
rst_name = 'home.rst'
```
# Settings
```python
# Optional, automatically maps roles, directives and transformers
DJANGO_DOCUTILS_LIB_RST = {
"docutils": {
"raw_enabled": True,
"strip_comments": True,
"initial_header_level": 2,
},
"roles": {
"local": {
"gh": "django_docutils.lib.roles.github.github_role",
"twitter": "django_docutils.lib.roles.twitter.twitter_role",
"email": "django_docutils.lib.roles.email.email_role",
}
},
"directives": {
"code-block": "django_docutils.lib.directives.code.CodeBlock",
}
}
# Optional
DJANGO_DOCUTILS_LIB_TEXT = {
"uncapitalized_word_filters": ["project.my_module.my_capitalization_fn"]
}
```
## More information
- Python 3.10+
- Django 4.2+
[](https://github.com/tony/django-docutils/actions?query=workflow%3A%22Docs%22)
[](https://github.com/tony/django-docutils/actions?query=workflow%3A%22tests%22)
[](https://codecov.io/gh/tony/django-docutils)
Raw data
{
"_id": null,
"home_page": null,
"name": "django-docutils",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "django, docutils, reST, reStructuredText, rst",
"author": null,
"author_email": "Tony Narlock <tony@git-pull.com>",
"download_url": "https://files.pythonhosted.org/packages/72/bf/2ac512994288ca201616a75bb87c1ed682e13af1d08c0b8b23fabb85888c/django_docutils-0.29.0.tar.gz",
"platform": null,
"description": "# django-docutils · [](https://pypi.org/project/django-docutils/) [](https://github.com/tony/django-docutils/blob/master/LICENSE)\n\ndocutils (a.k.a. reStructuredText / rst / reST) support for Django.\n\n## Quickstart\n\nInstall django-docutils:\n\n```console\n$ pip install django-docutils\n```\n\nNext, add `django_docutils` to your `INSTALLED_APPS` in your settings file:\n\n```python\nINSTALLED_APPS = [\n # ... your default apps,\n 'django_docutils'\n]\n```\n\n## Template tag\n\nIn your template:\n\n```django\n{% load django_docutils %}\n{% rst %}\n# hey\n# how's it going\nA. hows\nB. it\n\nC. going\nD. today\n\n**hi**\n*hi*\n{% endrst %}\n```\n\n## Template filter\n\nIn your template:\n\n```django\n{% load django_docutils %}\n{% filter rst %}\n# hey\n# how's it going\nA. hows\nB. it\n\nC. going\nD. today\n\n**hi**\n*hi*\n{% endfilter %}\n```\n\n## Template engine (class-based view)\n\nYou can also use a class-based view to render reStructuredText (reST).\n\nIf you want to use reStructuredText as a django template engine, `INSTALLED_APPS` _isn't_ required,\ninstead you add this to your `TEMPLATES` variable in your settings:\n\n```python\nTEMPLATES = [\n # ... Other engines\n {\n \"NAME\": \"docutils\",\n \"BACKEND\": \"django_docutils.template.DocutilsTemplates\",\n \"DIRS\": [],\n \"APP_DIRS\": True,\n }\n]\n```\n\nNow django will be able to scan for .rst files and process them. In your view:\n\n```python\nfrom django_docutils.views import DocutilsView\n\nclass HomeView(DocutilsView):\n template_name = 'base.html'\n rst_name = 'home.rst'\n```\n\n# Settings\n\n```python\n# Optional, automatically maps roles, directives and transformers\nDJANGO_DOCUTILS_LIB_RST = {\n \"docutils\": {\n \"raw_enabled\": True,\n \"strip_comments\": True,\n \"initial_header_level\": 2,\n },\n \"roles\": {\n \"local\": {\n \"gh\": \"django_docutils.lib.roles.github.github_role\",\n \"twitter\": \"django_docutils.lib.roles.twitter.twitter_role\",\n \"email\": \"django_docutils.lib.roles.email.email_role\",\n }\n },\n \"directives\": {\n \"code-block\": \"django_docutils.lib.directives.code.CodeBlock\",\n }\n}\n\n# Optional\nDJANGO_DOCUTILS_LIB_TEXT = {\n \"uncapitalized_word_filters\": [\"project.my_module.my_capitalization_fn\"]\n}\n```\n\n## More information\n\n- Python 3.10+\n- Django 4.2+\n\n[](https://github.com/tony/django-docutils/actions?query=workflow%3A%22Docs%22)\n[](https://github.com/tony/django-docutils/actions?query=workflow%3A%22tests%22)\n[](https://codecov.io/gh/tony/django-docutils)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Docutils (a.k.a. reStructuredText, reST, RST) support for django.",
"version": "0.29.0",
"project_urls": null,
"split_keywords": [
"django",
" docutils",
" rest",
" restructuredtext",
" rst"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e0eac39440db82fbfae0718af0d8ef3b79aaace77c5148132050358225f2e0f5",
"md5": "5816ffb0a023ccb813b136fca7851d3d",
"sha256": "2854db795482dcc75ab8ec7baa9db8bc4481ea025c3ba0db7d8bb2b549f4ea4d"
},
"downloads": -1,
"filename": "django_docutils-0.29.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5816ffb0a023ccb813b136fca7851d3d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 45485,
"upload_time": "2025-11-01T17:17:18",
"upload_time_iso_8601": "2025-11-01T17:17:18.343324Z",
"url": "https://files.pythonhosted.org/packages/e0/ea/c39440db82fbfae0718af0d8ef3b79aaace77c5148132050358225f2e0f5/django_docutils-0.29.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "72bf2ac512994288ca201616a75bb87c1ed682e13af1d08c0b8b23fabb85888c",
"md5": "18ff876c5cba16b37269cdcc3e1bf40c",
"sha256": "1beaace08ccac7b5b8ad2149474975afaa07493e0780a23aadbf8399669e263a"
},
"downloads": -1,
"filename": "django_docutils-0.29.0.tar.gz",
"has_sig": false,
"md5_digest": "18ff876c5cba16b37269cdcc3e1bf40c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 153586,
"upload_time": "2025-11-01T17:17:19",
"upload_time_iso_8601": "2025-11-01T17:17:19.638789Z",
"url": "https://files.pythonhosted.org/packages/72/bf/2ac512994288ca201616a75bb87c1ed682e13af1d08c0b8b23fabb85888c/django_docutils-0.29.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-01 17:17:19",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "django-docutils"
}