funky-future
funky-future

Reputation: 3988

How can I reference a class from a specific documentation with Intersphinx?

I have set up an Intersphinx-mapping for the documentations of Python 2 and Python 3:

intersphinx_mapping = {'py2': ('http://docs.python.org/', None),
                       'py3': ('http://docs.python.org/3', None)}

How can I reference a class from a specific of these two resources? The documentation only mentions :ref:erences and these two attempts do not work:

:ref:`collections.Mapping <py2:collections.Mapping>`
:class:`py3:collections.Mapping`

While this generates an expected link:

:class:`collections.Mapping`

Upvotes: 2

Views: 376

Answers (1)

mzjn
mzjn

Reputation: 51052

The markup below produces working links with your intersphinx_mapping configuration (for py2, I suggest changing the URL to http://docs.python.org/2 to make the version explicit).

Python 2:

:class:`py2:collections.Mapping`

Python 3 (Mapping was moved to collections.abc in Python 3.3):

:class:`py3:collections.abc.Mapping`

Upvotes: 3

Related Questions