How can I get my Sphinx RST file to include a link to the "contents.html" Python help page?
More Details
I have an RST help document (index.rst) in an offline environment. I have downloaded and successfully built the Python documentation using the command make.bat html
. I then copied this documentation to C:\Temp\PyDoc.
I then updated my conf.py file to include the following Intersphinx mapping:
intersphinx_mapping = {'python': ('C:/Temp/PyDoc', None)}
Then, within my index.rst file, I have something like:
Contents:
.. toctree::
:maxdepth: 1
:ref:`Python <python:contents>`
The Python link is removed from the resulting documentation with the warning message:
WARNING: toctree contains reference to nonexisting document ':ref:`Python <python:contents>`'
I have verified that the output contains the text:
loading intersphinx inventory from C:/Temp/PyDoc/objects.inv...
I have also verified that the "contents" tag exists within the Python documentation by running:
python -m sphinx.ext.intersphinx "C:/Temp/PyDoc/objects.inv" | findstr contents
Which generates output that includes the line:
contents Python Documentation contents : contents.html
Does anyone know how to reference this external documentation from my RST file?
:any:
instead of:ref:
? – mzjn:ref:
replaced by:any:
. – Jeff G:ref:
to work, since that role is used for cross-references to explicit labels such as.. _contents:
. The page that you want to link to does not contain any label (see github.com/python/cpython/blob/3.6/Doc/contents.rst). – mzjn:any:`Python <python:contents>`
works for me if it is a regular inline cross-reference (not a toctree item), usingintersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
. – mzjn