sphinx-doc / sphinx-doc/sphinx

[Feature Request] A new role for hyperlink

Open
#9,796 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domains:py type:proposal
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

The current role :any: is limited.

  1. It sometimes not working.
    :any:`collections.abc.Iterable` does not work, while :class:`collections.abc.Iterable` works.
    It doesn't work in nested types, say list[int] or dict[str, int]
  2. In the meantime, the hyperlinks in :type:, :vartype: and :rtype: work very well, but it seems the format of them (italic normal text using em tag) is quite different from cross-reference using :class: or :any: (code tag).

Therefore, I hope sphinx could make a new role to reach the same effect as what we do to get the hyperlink in :type:, :vartype: and :rtype:, and with the same format. This shall help us improve the current napoleon return types when use_rtype=False.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the :any:, :class:, :type:, :vartype:, and :rtype: roles resolve links and render formatting, then inspect the Napoleon return-type handling when use_rtype=False. Done should include a new role that supports the requested type links, including nested types, and matches the existing type-role formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.