You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/usage.rst
+15-10
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,7 @@ and will embed the content of the document/section the link is pointing to, into
7
7
8
8
``:hoverxref:`` role uses Sphinx's internals reference resolution to find out where the link points to.
9
9
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 Sphinx's :rst:role:`ref` for more information.
13
11
14
12
Simplest usage example,
15
13
@@ -42,14 +40,23 @@ Show a tooltip for :doc:`Read the Docs automation rules <readthedocs:automation-
42
40
43
41
.. note::
44
42
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>`.
47
54
48
55
49
56
Tooltip on custom object
50
57
------------------------
51
58
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>`).
53
60
``hoverxref`` can also show a tooltip on these objects if desired.
54
61
You need to tell ``hoverxref`` which are the roles where the tooltip has to appear on.
55
62
To do this, use :confval:`hoverxref_roles <hoverxref_roles>` config.
@@ -119,9 +126,9 @@ These actions are usually calling a Javascript function.
119
126
120
127
.. warning::
121
128
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.
123
130
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.
125
132
126
133
.. _a feature to only include JS/CSS in pages where they are used: https://github.com/sphinx-doc/sphinx/pull/8631
127
134
.. _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
151
158
Show a :hoverxref:`tooltip with Mathjax <mathjax:Mathjax>` formulas.
0 commit comments