sphinx-togglebutton
A small sphinx extension to make it possible to add a "toggle button" to sections of your page. This allows you to:
- Collapse Sphinx admonitions (notes, warnings, etc) so that their content is hidden until users click a toggle button.
- Collapse arbitrary chunks of content on your page with a
collapsedirective.
Installation
You can install sphinx-togglebutton with pip:
pip install sphinx-togglebutton
Usage
In your conf.py configuration file, add sphinx_togglebutton
to your extensions list.
E.g.:
extensions = [
...
'sphinx_togglebutton'
...
]
Now, whenever you wish for an admonition to be toggle-able, add the
:class: dropdown parameter to the admonition directive that you use.
For example, this code would create a toggle-able "note" admonition that starts hidden:
.. note::
:class: dropdown
This is my note.
Clicking on the toggle button will toggle the item's visibility.
You may also show the content by default. To do so, add the dropdown
class as well as a toggle-shown class, like so:
.. note::
:class: dropdown, toggle-shown
This is my note.
You can also use containers to add arbitrary toggle-able code. For example, here's a container with an image inside:
.. container:: toggle, toggle-hidden
.. admonition:: Look at that, an image!
.. image:: https://media.giphy.com/media/mW05nwEyXLP0Y/giphy.gif
Internationalization (i18n)
The texts Click to hide and Click to show used in the toggle buttons are internationalized by using the set language from Sphinx's configuration.
Supported languages are English (default), Chinese (Simplified), Chinese (Traditional), Hindi, Spanish, French, Arabic, Bengali, Russian, Portuguese, Indonesian, Japanese, German, Korean, Turkish, Vietnamese, Tamil, Italian, Thai, Dutch, Greek, Polish, Ukrainian, Persian, Malay, Swahili, Romanian, Czech, Hungarian, Hebrew, Swedish, and Norwegian.
Metadata
Release files for sphinx-togglebutton 0.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sphinx_togglebutton-0.4.5.tar.gz | 18.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinx_togglebutton-0.4.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.0 kB
Security for sphinx-togglebutton 0.4.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.