Skip to content
Back to top
View this page

# `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 and will override any of the global configuration options (without the `autodoc2_` prefix).

## Literal representation

For example:

    .. autodoc2-object:: autodoc2.sphinx.docstring._example
        :literal:
        :literal-lexer: restructuredtext

        render_plugin = "rst"
        no_index = true

creates:

## Rendered representation

For example:

    .. autodoc2-object:: autodoc2.sphinx.docstring._example

        render_plugin = "rst"
        no_index = true

creates:

## Rendered representation (signature only)

Or without annotations and docstring:

    .. autodoc2-object:: autodoc2.sphinx.docstring._example

        render_plugin = "rst"
        no_index = true
        annotations = false
        docstrings = false

creates: