Docutils components

Registry-aware reference for every docutils component django-docutils ships, generated by sphinx-autodoc-docutils. Each entry surfaces the component’s registry metadata — a transform’s default_priority, the writer’s resolved translator class, a role’s content support — and registers a cross-reference target in the docutils domain, so prose anywhere in these docs can link straight to a component: DjangoDocutilsWriter, CodeTransform.

django-docutils registers nothing with Sphinx itself (no builders, domains, or config values) — it is a Django-side docutils consumer — so the docutils component family below is the complete inventory.

Writer

Full API: lib.writers.

django_docutils.lib.writers.DjangoDocutilsWriter
writer
writer
django_docutils.lib.writers.DjangoDocutilsWriter

DjangoDocutils’s hand-crafted docutils’ writer.

Python path:

django_docutils.lib.writers.DjangoDocutilsWriter

Supported formats:

html5, xhtml, html

Translator class:

django_docutils.lib.writers.DjangoDocutilsHTMLTranslator

Config section:

html5 writer

Transforms:

Messages, FilterMessages, StripClassesAndElements, Admonitions

Translator

The translator’s Overrides fact lists only the visit/depart handlers the class defines itself — the customizations layered on docutils’ HTML5 translator.

Full API: lib.writers.

django_docutils.lib.writers.DjangoDocutilsHTMLTranslator
translator
translator
django_docutils.lib.writers.DjangoDocutilsHTMLTranslator

Django Docutils touchups to docutil’s HTML renderer.

Transforms

Full API: lib.roles.transforms.code, lib.roles.transforms.toc, and lib.sanitize.

django_docutils.lib.transforms.code.CodeTransform
transform priority 120
transform priority 120
django_docutils.lib.transforms.code.CodeTransform

Run over unparsed literals and try to guess language + highlight.

Python path:

django_docutils.lib.transforms.code.CodeTransform

Default priority:

120

django_docutils.lib.transforms.toc.Contents
transform priority 720
transform priority 720
django_docutils.lib.transforms.toc.Contents

Helpers for rendering docutils table of contents from document tree.

Python path:

django_docutils.lib.transforms.toc.Contents

Default priority:

720

django_docutils.lib.sanitize.SanitizeTransform
transform priority 990
transform priority 990
django_docutils.lib.sanitize.SanitizeTransform

Run sanitize_doctree() as a docutils transform.

Python path:

django_docutils.lib.sanitize.SanitizeTransform

Default priority:

990

Directives

Registered under the name configured in DJANGO_DOCUTILS_LIB_RST (code-block by default, with sourcecode as a common alias) via django_docutils.lib.directives.code.register_pygments_directive(). Full API: lib.directives.code.

.. codeblock::
directive
directive
.. codeblock::

Source code syntax highlighting.

Python path:

django_docutils.lib.directives.code.CodeBlock

Required arguments:

1

Optional arguments:

0

Final argument whitespace:

True

Has content:

True

Roles

Role names shown here derive from the callable names; the names actually registered with docutils come from the roles mapping in DJANGO_DOCUTILS_LIB_RST (for example gh for github). Full API: lib.roles.

:email:
role
role
:email:

Role for linking to email articles.

:file:
role
role
:file:

Role for files.

:manifest:
role
role
:manifest:

Role for manifests (package.json, file outputs).

:github:
role
role
:github:

Role for linking to GitHub repos and issues.

:hackernews:
role
role
:hackernews:

Role for linking to hackernews articles.

:kbd:
role
role
:kbd:

Role for <kbd>, the keyboard input element.

:leanpub:
role
role
:leanpub:

Role for linking to leanpub page.

:pypi:
role
role
:pypi:

Role for linking to PyPI (Python Package Index) page.

:readthedocs:
role
role
:readthedocs:

Role for linking to readthedocs.org page.

:twitter:
role
role
:twitter:

Role for linking to twitter articles.

:url:
role
role
:url:

Role for linking to url articles.

:wikipedia:
role
role
:wikipedia:

Role for linking to Wikipedia articles.