Skip to content

Commit 9d5172b

Browse files
authored
Merge pull request #8 from choldgraf/selector
documenting custom selector
2 parents 3fffdb8 + 9a18e45 commit 9d5172b

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# ones.
4141
extensions = ["myst_nb", "sphinx_togglebutton"]
4242

43-
# togglebutton_selector = ".toggle, .secondtoggle"
43+
togglebutton_selector = ".toggle, .toggle-this-item"
4444

4545
# Add any paths that contain templates here, relative to this directory.
4646
templates_path = ["_templates"]

docs/index.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,41 @@ Here's how they look right after one another:
167167
Configuration
168168
=============
169169

170+
Below are a few configuration points for ``sphinx-togglebutton``.
171+
172+
173+
Control the selector text used to make elements toggle-able
174+
-----------------------------------------------------------
175+
176+
By default, ``sphinx-togglebutton`` selects any items that have the class ``.toggle``
177+
and adds a toggle-button to them. If you'd like to change this class, for example to
178+
select a different kind of HTML element, you may configure this field manually like so
179+
in your ``conf.py`` file:
180+
181+
.. code-block:: python
182+
183+
togglebutton_selector = "your-selector"
184+
185+
For example, if you wanted to add toggle-buttons to all HTML elements that had a
186+
``toggle-this-item`` class, in *addition* to the default class of ``toggle``,
187+
you could do so with the following configuration:
188+
189+
.. code-block:: python
190+
191+
togglebutton_selector = ".toggle, .toggle-this-item"
192+
193+
194+
This is what has been done for the toggle-able section below:
195+
196+
.. note::
197+
:class: toggle-this-item
198+
199+
A toggled note with a custom class to trigger toggling.
200+
201+
202+
Control the togglebutton hover text
203+
-----------------------------------
204+
170205
You can control the "hint" text that is displayed next to togglebuttons when
171206
their content is collapsed. To do so, use the following configuration variable
172207
in your ``conf.py`` file:

0 commit comments

Comments
 (0)