1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
# `autodoc-object` directive
The `autodoc-object` directive can be used to render the documentation for a single Python object.
It takes a single argument, the fully qualified name of the object that should be rendered.
Using the `:literal:` option, the pre-rendered content will be rendered as a literal block,
and the `:literal-lexer:` option can be used to specify the lexer to use for syntax highlighting.
The directive can contain content,
which is read as [TOML](https://toml.io) and will override any of the {ref}`global configuration <config:global>` options (without the `autodoc2_` prefix).
## Literal representation
For example:
````restructuredtext
.. autodoc2-object:: autodoc2.sphinx.docstring._example
:literal:
:literal-lexer: restructuredtext
render_plugin = "rst"
no_index = true
````
creates:
```{autodoc2-object} autodoc2.sphinx.docstring._example
:literal:
:literal-lexer: restructuredtext
render_plugin = "rst"
no_index = true
```
## Rendered representation
For example:
````restructuredtext
.. autodoc2-object:: autodoc2.sphinx.docstring._example
render_plugin = "rst"
no_index = true
````
creates:
```{autodoc2-object} autodoc2.sphinx.docstring._example
render_plugin = "myst"
no_index = true
```
## Rendered representation (signature only)
Or without annotations and docstring:
````restructuredtext
.. autodoc2-object:: autodoc2.sphinx.docstring._example
render_plugin = "rst"
no_index = true
annotations = false
docstrings = false
````
creates:
```{autodoc2-object} autodoc2.sphinx.docstring._example
render_plugin = "myst"
no_index = true
annotations = false
docstrings = false
```
|