Disambiguating intersphinx references

24 views
Skip to first unread message

R Edgar

unread,
Aug 14, 2020, 10:58:04 AM8/14/20
to sphinx-users
Greetings,

I'm trying to generate a reference to my project's examples, as generated by sphinx-gallery. The normal way to do this is:
:ref:`sphx_glr_auto_examples`
(since the target is defined by Sphinx gallery itself). However, we are also using intersphinx to reference our dependencies, and SciKit-Learn also uses sphinx-gallery. When our documentation is built, the link generated points at the SciKit-Learn examples, rather than our own.

How do I force the link to reference the target in our project, rather than the one in SciKit-Learn? I've been trying adding things like :project: and :Fairlearn: (the name of our project in conf.py) at various places, but they are not working.

Thanks in advance,

Richard

Komiya Takeshi

unread,
Aug 14, 2020, 1:22:10 PM8/14/20
to sphinx...@googlegroups.com
Hi,

I'm not familiar with sphinx-gallery. So I'm saying about only
intersphinx's behavior.
The intersphinx works as a fallback on resolving cross-references. So
Sphinx tries to resolve it on local document at first. And it calls
intersphinx only if not resolved. In other words, all of the
references will be linked to the local project by default. It will be
linked to external documents only if the label is not found on the
local document.

Thanks,
Takeshi KOMIYA

2020年8月14日(金) 23:58 R Edgar <freesur...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/278871ec-bbca-47ec-ae28-94803ea89dddo%40googlegroups.com.

R Edgar

unread,
Aug 14, 2020, 3:21:19 PM8/14/20
to sphinx...@googlegroups.com
On Fri, 14 Aug 2020 at 17:22, Komiya Takeshi <i.tk...@gmail.com> wrote:
>
> I'm not familiar with sphinx-gallery. So I'm saying about only
> intersphinx's behavior.
> The intersphinx works as a fallback on resolving cross-references. So
> Sphinx tries to resolve it on local document at first. And it calls
> intersphinx only if not resolved. In other words, all of the
> references will be linked to the local project by default. It will be
> linked to external documents only if the label is not found on the
> local document.

Yes - I eventually found the issue via:
python -m sphinx.ext.intersphinx build/html/objects.inv
which revealed that I had the wrong sphinx-gallery link

Thanks,

Richard

Daniel Scott

unread,
Nov 25, 2020, 10:34:20 PM11/25/20
to sphinx...@googlegroups.com
--
Reply all
Reply to author
Forward
0 new messages