intersphinx -- how does mapping find domain name?

61 views
Skip to first unread message

Carl Gay

unread,
Sep 14, 2020, 2:21:54 PM9/14/20
to sphinx-users
Hi, we us Sphinx to document the Dylan language. I would like to use intersphinx to make it so that any Dylan library documentation can easily link to any other via :dylan:func:`foo` and similar markup. Someone wrote a Sphinx domain for Dylan but I'm not super familiar with it (or Sphinx) yet.

In this commit I added an intersphinx mapping to our Library Reference docs' conf.py and then added a test link to index.rst, but Sphinx doesn't find the xref. To verify that the intersphinx_mapping config is working I also added the Python mapping and a :py: test link, which works fine.

My question is, obviously, why doesn't this work?  But more specifically, how does Sphinx make the connection from the intersphinx mapping, which uses the string 'python' to the domain name 'py' in :py:class:`zipfile.ZipFile`?

Thanks.

Carl Gay

unread,
May 1, 2021, 11:03:09 AM5/1/21
to sphinx-users
Just noticed this was never answered, so to close the loop...

It turns out I just had the wrong syntax for the references. This works:  :func:`http:add-resource`, where "http" is one of the keys in the intersphinx_mapping config and "add-resource" is the name of a function in that document.

Komiya Takeshi

unread,
May 2, 2021, 1:28:38 AM5/2/21
to sphinx...@googlegroups.com
Hi,

The intersphinx basically works transparently. It automatically
converts cross-references to remote references if the reference target
not found locally.
A reference :py:class:`zipfile.ZipFile` will be converted to a) a
local reference if local document has an entry for zipfile.ZipFile, or
b) a remote reference via intersphinx feature. So you don't need to
pass the mapping name to references.
Of course, you can pass the intersphinx-mapping name to the reference
explicitly as you said.

I've never tried to use the Dylan domain, but I believe intersphinx
also supports it.

Thanks,
Takeshi KOMIYA

2021年5月2日(日) 0:03 Carl Gay <car...@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/d6520d32-97ea-4a4c-9b0e-bb74eb4f75efn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages