Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Commit 0096aee

Browse files
committed
Add some intersphinx external examples and minor details
1 parent 171920a commit 0096aee

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

Diff for: docs/conf.py

+9
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,23 @@
5555
intersphinx_mapping = {
5656
'readthedocs': ('https://docs.readthedocs.io/en/stable/', None),
5757
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
58+
'sympy': ('https://docs.sympy.org/latest/', None),
59+
'numpy': ('https://numpy.org/doc/stable/', None),
60+
'python': ('https://docs.python.org/3/', None),
5861
}
5962
hoverxref_intersphinx = [
6063
'readthedocs',
6164
'sphinx',
65+
'sympy',
66+
'numpy',
67+
'python',
6268
]
6369
hoverxref_intersphinx_types = {
6470
'readthedocs': 'modal',
6571
'sphinx': 'tooltip',
72+
'sympy': 'tooltip',
73+
'numpy': 'tooltip',
74+
'python': 'tooltip',
6675
}
6776

6877
# Used when building the documentation from the terminal and using a local Read

Diff for: docs/configuration.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ These settings are global and have effect on both, tooltips and modal dialogues.
101101

102102
.. warning::
103103

104-
The Sphinx's target project **must be hosted on Read the Docs** to work.
105-
This is a current limitation that we hope to remove in the future.
104+
The Sphinx's target project **must be hosted on Read the Docs** to work or,
105+
be one of the allowed external projects:
106+
currently CPython, SymPy, NumPy are supported.
106107

107108
.. confval:: hoverxref_intersphinx_types
108109

Diff for: docs/installation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ you can use ``:hoverxref:`` role to show a tooltip [#]_ when hovering with the m
3737
.. warning::
3838

3939
This extension **requires a backend server** to retrieve the tooltip content.
40-
Currently only `Read the Docs`_ is supported,
41-
so it will only work if your documentation is hosted on Read the Docs.
40+
Currently, only `Read the Docs`_ is supported as backend server.
41+
Take into account that your documentation has to be hosted on Read the Docs for this extension to work.
4242

4343
If you prefer to apply this behavior to *all* your ``:ref:`` in your documentation,
4444
you can use the config :confval:`hoverxref_auto_ref`.

Diff for: docs/usage.rst

+15-10
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ and will embed the content of the document/section the link is pointing to, into
77

88
``:hoverxref:`` role uses Sphinx's internals reference resolution to find out where the link points to.
99
So, the way of referencing the section works in the same way as the ``:ref:`` standard role.
10-
See `Sphinx's ref role documentation`_ for more information.
11-
12-
.. _Sphinx's ref role documentation: https://www.sphinx-doc.org/en/stable/usage/restructuredtext/roles.html#cross-referencing-arbitrary-locations
10+
See :ref:`Sphinx's ref role documentation <sphinx:ref-role>` for more information.
1311

1412
Simplest usage example,
1513

@@ -42,14 +40,23 @@ Show a tooltip for :doc:`Read the Docs automation rules <readthedocs:automation-
4240

4341
.. note::
4442

45-
Keep in mind that the linked project should be hosted at Read the Docs.
46-
This is a limitation that will be removed in the future.
43+
Keep in mind that the linked project should be hosted at Read the Docs or,
44+
be one of the allowed external projects:
45+
currently CPython, SymPy, NumPy are supported.
46+
47+
48+
Example with projects not hosted on Read the Docs
49+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
51+
* Show a tooltip for CPython documentation: :py:mod:`webbrowser <webbrowser>`.
52+
* Show a tooltip for SymPy documentation: :py:class:`sympy.functions.combinatorial.numbers.tribonacci <sympy.functions.combinatorial.numbers.tribonacci>`.
53+
* Show a tooltip for NumPy documentation: :py:class:`numpy.single <numpy.single>`.
4754

4855

4956
Tooltip on custom object
5057
------------------------
5158

52-
Sphinx has the ability to define custom objects (via `Sphinx.add_object_type`_).
59+
Sphinx has the ability to define custom objects (via :py:meth:`Sphinx.add_object_type <sphinx.application.Sphinx.add_object_type>`).
5360
``hoverxref`` can also show a tooltip on these objects if desired.
5461
You need to tell ``hoverxref`` which are the roles where the tooltip has to appear on.
5562
To do this, use :confval:`hoverxref_roles <hoverxref_roles>` config.
@@ -119,9 +126,9 @@ These actions are usually calling a Javascript function.
119126

120127
.. warning::
121128

122-
Note that Sphinx>3.5 adds `a feature to only include JS/CSS in pages where they are used`_ instead of in all the pages.
129+
Note that Sphinx>=3.5 adds `a feature to only include JS/CSS in pages where they are used`_ instead of in all the pages.
123130
This `may affect the rendering of tooltips`_ that includes content requiring extra rendering steps.
124-
**Make sure you are using Sphinx 3.4.x or >=4.1.x** if you require rendering this type of content in your tooltips.
131+
**Make sure you are using Sphinx <=3.4.x or >=4.1.x** if you require rendering this type of content in your tooltips.
125132

126133
.. _a feature to only include JS/CSS in pages where they are used: https://github.com/sphinx-doc/sphinx/pull/8631
127134
.. _may affect the rendering of tooltips: https://github.com/sphinx-doc/sphinx/issues/9115
@@ -151,8 +158,6 @@ To render a tooltip where its contents has a ``mathjax`` you need to enable :con
151158
Show a :hoverxref:`tooltip with Mathjax <mathjax:Mathjax>` formulas.
152159

153160

154-
.. _Sphinx.add_object_type: https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_object_type
155-
156161
.. _sphinx-tabs: https://github.com/djungelorm/sphinx-tabs
157162
.. _mathjax: http://www.sphinx-doc.org/es/master/usage/extensions/math.html#module-sphinx.ext.mathjax
158163

0 commit comments

Comments
 (0)