vijolica
vijolica

Reputation: 358

Linking external documentation in Sphinx

I am trying to link from our project's extension documentation to the core documentation in Sphinx. I've tried intersphinx, but from what I see it only supports objects, while our documentation doesn't refer to objects, it's just plain .rst.

I've added

intersphinx_mapping = {
    'project': ('http://link-to-readthedocs/index.html', None),
}

to conf.py and edited the link to :ref:\`Documentation\` and later :doc:\`Documentation\` . It didn't work.

The question:

How to link from one projects' documentation to another in Sphinx for plain .rst files (not objects)?

Edit: I've done make html, found my objects.inv, but now I guess I only have it locally? I'm not sure what I'm doing anymore, but when I try to check the object references, I get:

UserWarning: intersphinx inventory 'http://myproject.com/index.html/objects.inv' not fetchable due to <class 'urllib.error.HTTPError'>: HTTP Error 404: Not Found
  '%s: %s' % (inv, err.__class__, err))

Upvotes: 3

Views: 1305

Answers (1)

hBy2Py
hBy2Py

Reputation: 1832

The first thing to fix here is the link you've included to the base URL of your project docs:

intersphinx_mapping = { 'project': ('http://link-to-readthedocs/index.html', None), }

According to the intersphinx docs:

A dictionary mapping unique identifiers to a tuple (target, inventory). Each target is the base URI of a foreign Sphinx documentation set and can be a local path or an HTTP URI. The inventory indicates where the inventory file can be found: it can be None (at the same location as the base URI) or another local or HTTP URI.

Thus, the error is in having the index.html at the end of your target. It should instead look something like this:

intersphinx_mapping = { 'project': ('http://project.readthedocs.io/en/latest', None), }

If desired, replace en with the preferred docs language, and latest with the preferred RtD built version of the docs.

Upvotes: 3

Related Questions