module documentation

Utility functions for docutils.

Unknown Field: copyright
Copyright 2007-2022 by the Sphinx team, see AUTHORS.
Unknown Field: license
BSD, see LICENSE for details.
Class ​Reference​Role A base class for reference roles.
Class ​Sphinx​Directive A base class for Sphinx directives.
Class ​Sphinx​Role A base class for Sphinx roles.
Variable __document​_cache__ Undocumented
Variable __version​_info__ Undocumented
Variable additional​_nodes Undocumented
Variable logger Undocumented
Variable report​_re Undocumented
Class ​Custom​Re​STDispatcher Custom reST's mark-up dispatcher.
Class ​Element​Lookup​Error Undocumented
Class ​Logging​Reporter No class docstring; 0/1 method, 1/1 class method documented
Class ​Null​Reporter A dummy reporter; write nothing.
Class sphinx​_domains Monkey-patch directive and role dispatch, so that domain-specific markup takes precedence.
Class ​Sphinx​File​Output Better FileOutput class for Sphinx.
Class ​Sphinx​Translator A base class for Sphinx translators.
Class ​Warning​Stream Undocumented
Function docutils​_namespace Create namespace for reST parsers.
Function findall Undocumented
Function is​_directive​_registered Check the name directive is already registered.
Function is​_html5​_writer​_available Undocumented
Function is​_node​_registered Check the node is already registered.
Function is​_role​_registered Check the name role is already registered.
Function new​_document Return a new empty document object. This is an alternative of docutils'.
Function patch​_docutils Patch to docutils temporarily.
Function patched​_get​_language Patch docutils.languages.get_language() temporarily.
Function register​_directive Register a directive to docutils.
Function register​_node Register a node to docutils.
Function register​_role Register a role to docutils.
Function switch​_source​_input Switch current source input of state temporarily.
Function unregister​_node Unregister a node from docutils.
Function unregister​_role Unregister a role from docutils.
Function using​_user​_docutils​_conf Let docutils know the location of docutils.conf for Sphinx.
__document_cache__: Optional[nodes.document] =

Undocumented

__version_info__ =

Undocumented

additional_nodes: Set[Type[Element]] =

Undocumented

logger =

Undocumented

report_re =

Undocumented

@contextmanager
def docutils_namespace():
Create namespace for reST parsers.
Returns
Generator[None, None, None]Undocumented
def findall(self, *args, **kwargs):

Undocumented

def is_directive_registered(name):
Check the name directive is already registered.
Parameters
name:strUndocumented
Returns
boolUndocumented
def is_html5_writer_available():

Undocumented

Returns
boolUndocumented
def is_node_registered(node):
Check the node is already registered.
Parameters
node:Type[Element]Undocumented
Returns
boolUndocumented
def is_role_registered(name):
Check the name role is already registered.
Parameters
name:strUndocumented
Returns
boolUndocumented
def new_document(source_path, settings=None):

Return a new empty document object. This is an alternative of docutils'.

This is a simple wrapper for docutils.utils.new_document(). It caches the result of docutils' and use it on second call for instantiation. This makes an instantiation of document nodes much faster.

Parameters
source​_path:strUndocumented
settings:AnyUndocumented
Returns
nodes.documentUndocumented
@contextmanager
def patch_docutils(confdir=None):
Patch to docutils temporarily.
Parameters
confdir:Optional[str]Undocumented
Returns
Generator[None, None, None]Undocumented
@contextmanager
def patched_get_language():

Patch docutils.languages.get_language() temporarily.

This ignores the second argument reporter to suppress warnings. refs: https://github.com/sphinx-doc/sphinx/issues/3788

Returns
Generator[None, None, None]Undocumented
def register_directive(name, directive):

Register a directive to docutils.

This modifies global state of docutils. So it is better to use this inside docutils_namespace() to prevent side-effects.

Parameters
name:strUndocumented
directive:Type[Directive]Undocumented
def register_node(node):

Register a node to docutils.

This modifies global state of some visitors. So it is better to use this inside docutils_namespace() to prevent side-effects.

Parameters
node:Type[Element]Undocumented
def register_role(name, role):

Register a role to docutils.

This modifies global state of docutils. So it is better to use this inside docutils_namespace() to prevent side-effects.

Parameters
name:strUndocumented
role:RoleFunctionUndocumented
@contextmanager
def switch_source_input(state, content):
Switch current source input of state temporarily.
Parameters
state:StateUndocumented
content:StringListUndocumented
Returns
Generator[None, None, None]Undocumented
def unregister_node(node):

Unregister a node from docutils.

This is inverse of nodes._add_nodes_class_names().

Parameters
node:Type[Element]Undocumented
def unregister_role(name):
Unregister a role from docutils.
Parameters
name:strUndocumented
@contextmanager
def using_user_docutils_conf(confdir):
Let docutils know the location of docutils.conf for Sphinx.
Parameters
confdir:Optional[str]Undocumented
Returns
Generator[None, None, None]Undocumented