Skip to content

Commit fe25300

Browse files
committed
Add modal configs and fix some small typos
1 parent 497d790 commit fe25300

File tree

4 files changed

+129
-22
lines changed

4 files changed

+129
-22
lines changed

docs/configuration.rst

Lines changed: 122 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@ Configuration
22
=============
33

44
The default settings should be enough for most of the cases.
5-
For more specific use cases, you can customize these configuration options in your ``conf.py`` file:
5+
For more specific use cases, you can customize these configuration options in your ``conf.py`` file.
6+
7+
8+
General settings
9+
----------------
10+
11+
.. confval:: hoverxref_type
12+
13+
Description: How to display the embedded content. As a Tooltip or as a Modal dialogue
14+
15+
Default: ``tooltip``
16+
17+
Options: ``tooltip`` or ``modal``
18+
19+
Type: string
620

721
.. confval:: hoverxref_project
822

@@ -20,14 +34,6 @@ For more specific use cases, you can customize these configuration options in yo
2034

2135
Type: string
2236

23-
.. confval:: hoverxref_tooltip_api_host
24-
25-
Description: Host URL for the API to retrieve the tooltip content
26-
27-
Default: ``https://readthedocs.org``
28-
29-
Type: string
30-
3137
.. confval:: hoverxref_auto_ref
3238

3339
Description: Make all ``:ref:`` role to show a tooltip
@@ -56,14 +62,6 @@ For more specific use cases, you can customize these configuration options in yo
5662

5763
Type: list
5864

59-
.. confval:: hoverxref_tooltip_class
60-
61-
Description: CSS class to add to ``div`` created for the tooltip
62-
63-
Default: ``rst-content``
64-
65-
Type: string
66-
6765
.. confval:: hoverxref_sphinxtabs
6866

6967
Description: trigger an extra step to render tooltips where its content has a `Sphinx Tabs`_
@@ -84,9 +82,31 @@ For more specific use cases, you can customize these configuration options in yo
8482

8583
.. _Mathjax: http://www.sphinx-doc.org/es/master/usage/extensions/math.html#module-sphinx.ext.mathjax
8684

85+
86+
Tooltipster
87+
-----------
88+
89+
.. confval:: hoverxref_tooltip_api_host
90+
91+
Description: Host URL for the API to retrieve the tooltip content
92+
93+
Default: ``https://readthedocs.org``
94+
95+
Type: string
96+
97+
.. confval:: hoverxref_tooltip_class
98+
99+
Description: CSS class to add to ``div`` created for the tooltip
100+
101+
Default: ``rst-content``
102+
103+
Type: string
104+
105+
87106
.. warning::
88107

89-
The following settings are passed directly to Tooltipster_. See https://iamceege.github.io/tooltipster/#options for more information about their descriptions.
108+
The following settings are passed directly to Tooltipster_.
109+
See https://iamceege.github.io/tooltipster/#options for more information about their descriptions.
90110

91111
.. confval:: hoverxref_tooltip_theme
92112

@@ -131,3 +151,87 @@ For more specific use cases, you can customize these configuration options in yo
131151
Type: string
132152

133153
.. _Tooltipster: https://iamceege.github.io/tooltipster/
154+
155+
156+
MicroModal.js
157+
-------------
158+
159+
.. confval:: hoverxref_modal_hover_delay
160+
161+
Description: Delay time (in milliseconds) before showing the modal when hover over a ref
162+
163+
Default: ``350``
164+
165+
Type: int
166+
167+
.. confval:: hoverxref_modal_default_title
168+
169+
Description: Title shown when the content does not have one
170+
171+
Default: ``Note``
172+
173+
Type: string
174+
175+
.. confval:: hoverxref_modal_prefix_title
176+
177+
Description: Prefix included in the title of the modal
178+
179+
Default: 📝 (ends with a trailing space)
180+
181+
Type: string
182+
183+
.. confval:: hoverxref_modal_class
184+
185+
Description:
186+
187+
Default: ``rst-content``
188+
189+
Type: string
190+
191+
192+
.. warning::
193+
194+
The following settings are passed directly to `MicroModal.js`_.
195+
See https://micromodal.now.sh/#configuration for more information about their descriptions.
196+
197+
.. confval:: hoverxref_modal_onshow_function
198+
199+
Default: ``None``
200+
201+
Type: string
202+
203+
.. confval:: hoverxref_modal_openclass
204+
205+
Default: ``is-open``
206+
207+
Type: string
208+
209+
.. confval:: hoverxref_modal_disable_focus
210+
211+
Default: ``True``
212+
213+
Type: bool
214+
215+
.. confval:: hoverxref_modal_disable_scroll
216+
217+
Default: ``False``
218+
219+
Type: bool
220+
221+
.. confval:: hoverxref_modal_awaitopenanimation
222+
223+
Default: ``False``
224+
225+
Type: bool
226+
227+
.. confval:: hoverxref_modal_awaitcloseanimation
228+
229+
Default: ``False``
230+
231+
Type: bool
232+
233+
.. confval:: hoverxref_modal_debugmode
234+
235+
Default: ``False``
236+
237+
Type: bool

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Welcome to sphinx-hoverxref!
22
============================
33

4-
``sphinx-hoverxref`` is a Sphinx_ extension to add tooltips on the cross references of the documentation with the content of the linked section.
4+
``sphinx-hoverxref`` is a Sphinx_ extension to add tooltips on the cross references of the documentation embedding the content of the linked section.
55

66
Online documentation:
77
https://sphinx-hoverxref.readthedocs.io/

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ To do this, add this extension to your Sphinx's extensions in the ``conf.py`` fi
3232
3333
3434
After installing the package and adding the extension in the ``conf.py`` file,
35-
you can use ``:hoverxref:`` role to show tooltip when hovering with the mouse.
35+
you can use ``:hoverxref:`` role to show a tooltip when hovering with the mouse.
3636

3737
.. warning::
3838

docs/usage.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ Usage
22
=====
33

44
This extension defines a custom role called ``:hoverxref:``.
5-
When this role is used, it will show a tooltip when ``hover`` mouse event is triggered,
6-
and will populate the content tooltip with the content of the document and section the link is pointing to.
5+
When this role is used, it will show a tooltip when the ``hover`` mouse event is triggered,
6+
and will embed the content of the document/section the link is pointing to, into the tooltip's content.
77

88
``:hoverxref:`` 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#role-ref
1013

1114
Simplest usage example,
1215

0 commit comments

Comments
 (0)