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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions doc/usage/extensions/autosummary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,10 @@ 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
-------------

The ``:autolink:`` role functions as ``:obj:`` when the name referred can be
resolved to a Python object, and otherwise it becomes simple emphasis.
This can be used as the default role to make links 'smart'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should be more cautious here. I recall problems with users who've used this as a default role, where really they wanted to use py:obj. I don't have time to find discussion links, though, sorry.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see - I found some past issues in the repo.

How about something like

Suggested change
This can be used as the default role to make links 'smart'.
This can be used as the default role to make links 'smart', but must be used carefully. For example, in the case of multiple objects having the same name, `autolink` could resolve to the wrong object.