👌 IMPROVE: allow to specify a custom reference role for link-button #58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While trying to use sphinx-panels for the pandas docs (finally .. ;)), I ran into an issue with the link-button: because it's hardcoded to use an "any" role, this can give ambiguous targets ("WARNING: more than one target found for 'any' cross-reference ...").
While in actual rst, you could use
:ref:`target`
or:doc:`target`
or:func:`target`
, .. to be more specific.So I think it would be nice if it would be possible for
link-button
directive to support this as well. There is already a:type:
keyword (which now takes "url" or "ref"), which could be used for this. The only problem is that for backwards compatibility, "ref" should keep meaning "any", and not actually "ref". It also seems that sphinx automatically changes "ref" into "std:ref" (or this might depend on your settings, though?), and specifying "ref" as thereftype
without a domain gives errors in sphinx. So you have to use "std:ref" as a user, unfortunately (unless there is a sphinx function we can use to resolve those).I directly made a PR instead of an issue because I was trying it out anyway if it could work, and the diff might make my question/suggestion more concrete.
If there is interest in this, I can further clean-up the PR (and add tests, etc).