Skip to main content

Add a toggle button to items on a page.

Project description

sphinx-togglebutton

A small sphinx extension to make it possible to add a "toggle button" to sections of your page.

demo gif

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: toggle parameter to the admonition directive that you use.

For example, this code would create a toggle-able "note" admonition:

.. note::
    :class: toggle

    This is my note.

Clicking on the toggle button will toggle the item's visibility.

You may also hide the content by default. To do so, add the toggle class as well as a toggle-hidden class, like so:

.. note::
    :class: toggle, toggle-hidden

    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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-togglebutton-0.2.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

sphinx_togglebutton-0.2.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file sphinx-togglebutton-0.2.1.tar.gz.

File metadata

  • Download URL: sphinx-togglebutton-0.2.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for sphinx-togglebutton-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c81b20b8cf8b243cf6df2c2df5ae442a03c0a5a50bc24e7f248d9d1c50c70857
MD5 24c9f370d8f1958911feb2d9710404cd
BLAKE2b-256 0bd386cf0399c5ff188ca2ffe5d642abe6c65b4827760caaac496733c1500455

See more details on using hashes here.

File details

Details for the file sphinx_togglebutton-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sphinx_togglebutton-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for sphinx_togglebutton-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 048eb3c2b644c477e3c248016eaece93a767d7216ffa0183cb5cdef2e384a28d
MD5 a39a59bab2a0bb2b2ee515b06dda36dc
BLAKE2b-256 ad298ba305a63332cea8f66bb4673e8a06d62f2ad1089a0241b31269394102f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page