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

Uploaded Source

Built Distribution

sphinx_togglebutton-0.0.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx-togglebutton-0.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191029 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for sphinx-togglebutton-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2f0c1db0daaad05437d5c06112c5d75746b55d8b1842d82dae3f00648bba8ae9
MD5 1ca2b46f011f9d2afd4258fdd0154334
BLAKE2b-256 749817329c1a5daa7826fb567563c00ed9454c4ed30f3af0e2eb123342c5728d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sphinx_togglebutton-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191029 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for sphinx_togglebutton-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 52e60705be2ce92c6a62befb4949b6e44ab0c72e8677cddba5ca41c3d14d5b03
MD5 2c84df216e37b0cbcd82528344663805
BLAKE2b-256 d9da3bbed18e5f3442eb20336b66c7c1f4ca42208f1b17aeac7e90a835fbd662

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