autodoc2.sphinx.docstring¶
Directive for rendering docstrings.
Module Contents¶
Classes¶
Directive to render a docstring of an object. |
Functions¶
Return a docutils parser whose name matches the argument. (Directive option conversion function.) |
|
Must be empty or a positive integer. |
|
Restore the parsing context after a nested parse with a different parser. |
|
Temporarily change the source and line number. |
|
This is an example docstring, written in MyST. |
API¶
- autodoc2.sphinx.docstring.parser_options(argument: str) docutils.parsers.Parser | None[source]¶
Return a docutils parser whose name matches the argument. (Directive option conversion function.)
Return None, if the argument evaluates to False. Raise ValueError if importing the parser module fails.
- autodoc2.sphinx.docstring.summary_option(argument: str) int | None[source]¶
Must be empty or a positive integer.
- class autodoc2.sphinx.docstring.DocstringRenderer(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]¶
Bases:
sphinx.util.docutils.SphinxDirectiveDirective to render a docstring of an object.
Initialization
- has_content = False¶
- required_arguments = 1¶
- optional_arguments = 0¶
- final_argument_whitespace = True¶
- autodoc2.sphinx.docstring.parsing_context() Generator[None, None, None][source]¶
Restore the parsing context after a nested parse with a different parser.
- autodoc2.sphinx.docstring.change_source(state: docutils.parsers.rst.states.RSTStateMachine, source_path: str, line_offset: int) Generator[None, None, None][source]¶
Temporarily change the source and line number.
- autodoc2.sphinx.docstring._example(a: int, b: str) None[source]¶
This is an example docstring, written in MyST.
It has a code fence:
a = "hallo"
and a table:
a
b
c
1
2
3
and, using the
fieldlistextension, a field list:- Parameters:
a – the first parameter
b – the second parameter
- Returns:
the return value