Skip to content

need_incoming / need_outgoing/ need_part misuse sphinx reference role #1437

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
chrisjsewell opened this issue Apr 14, 2025 · 1 comment
Open
Assignees
Labels

Comments

@chrisjsewell
Copy link
Member

chrisjsewell commented Apr 14, 2025

The anatomy of a reference role is that

  • By default, the title == target, e.g. :name:`target`
  • The title can be separated from the title using <>, e.g. :name:`title <target>`
  • The reference can be disabled if the content starts with !, e.g. :name:`!target` or :name:`!title <target>`
  • The < or ! can be escaped with \, e.g. :name:`title \<target>` or :name:`\!target`

Firstly, it is of note that for all need / need_incoming / need_outgoing/ need_part, they are set as sphinx.XRefRole.

For all of these, the disabling of the role with ! works, i.e. a reference/part is not created for these.
It is not clear if this is even intended, nor is it documented.

For the title/target syntax, the need role works as expected.
For need_incoming / need_outgoing/ need_part, though this syntax is parsed, it is not used in an understandable way:
e.g. for :name:`title <target>`,

  • for need_incoming / need_outgoing only the target is used and the title is disregarded
  • for need_part only the title is used and the target is disregarded

Additionally, need_part, splits up id/content like (id) content, but does not account for space in between the ) and start of content


also there is no warning if need_part is not in a need directive, they are just silently ignored

@chrisjsewell chrisjsewell self-assigned this Apr 14, 2025
@PhilipPartsch
Copy link
Contributor

PhilipPartsch commented Apr 28, 2025

Is it possible to support even :any: with :need:?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants