Skip to main content

Add a toggle button to items on a page.

Project description

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

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.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

sphinx_togglebutton-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx-togglebutton-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for sphinx-togglebutton-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e6af3481cd76d9f3f7b2e8bea9e2a3503bf181a4bd3e0ab0feebdfc1a9d05e16
MD5 7ab18407c8191afc96bb0f7cc337def2
BLAKE2b-256 9971c762e440b8bf033fa65588f3d317dd14c6f7ff5e432aaa90962c62833179

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sphinx_togglebutton-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for sphinx_togglebutton-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0014a50e403b6297eee978d8aec934211d62429a1c0bf86b38f3cf1c51f57751
MD5 9191a67275cc82bd80c1399d9b693c77
BLAKE2b-256 8117f33f6b42d05d6bf386497fff93d5c1107756f139b068680a652713c5e48c

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