Skip to content

Document autolink role for autosummary #13596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions doc/usage/extensions/autosummary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,27 @@ the title of a page.
Stub pages are generated also based on these directives.

.. _`escape filter`: https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.escape

Autolink role
-------------

.. rst:role:: autolink

The ``:autolink:`` role functions as ``:py:obj:`` when the referenced *name*
can be resolved to a Python object, and otherwise it becomes simple emphasis.

There are some known design flaws.
For example, in the case of multiple objects having the same name,
:rst:role:`!autolink` could resolve to the wrong object.
It will fail silently if the referenced object is not found,
for example due to a spelling mistake or renaming.
This is sometimes unwanted behaviour.

Some users choose to configure their :confval:`default_role` to ``autolink``
for 'smart' referencing using the default interpreted text role (```content```).

.. seealso::

:rst:role:`any`

:rst:role:`py:obj`