Using a toggle button#
The sphinx-togglebutton extension allows text to be hidden.
Colapse warnings, admonitions,…#
This code…
.. admonition:: Click the title to toggle
:class: dropdown
This title was made into a dropdown admonition by adding `:class: dropdown` to it.
… creates this result:
Click the title to toggle
This title was made into a dropdown admonition by adding :class: dropdown to it.
Toggle text#
This is a toggled content block!
This is the code (also hidden in a toggle…):
.. toggle::
This is a toggled content block!
Hidding a long table#
Long tables make the documents akward to read.
Let’s test with a short table:
First name |
Last name |
|---|---|
John |
Doe |
Jane |
Dove |
Let’s check if they can be hidden using toggle:
First name |
Last name |
|---|---|
John |
Doe |
Jane |
Dove |
To show a different text, we need to use an admonition with a caption:
The table with the user list
First name |
Last name |
|---|---|
John |
Doe |
Jane |
Dove |
The admonition caption can even reference something in the hidden content, using numref and ref in the caption of the admonition but it becomes too convoluted…
Caution
Search for collapsible tables?
Can :class: dropdown be applied to normal tables?
No. Not directly. To be continued when time allows.
First name |
Last name |
|---|---|
John |
Doe |
Jane |
Dove |