Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# sphinx-togglebutton

A small sphinx extension to make it possible to add a "toggle button" to
sections of your page.
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 `collapse` directive.

![demo gif](docs/_static/demo.gif)

Expand Down
28 changes: 21 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ sphinx-togglebutton
===================

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

- Collapse admonitions (notes, warnings, etc) so that their content is hidden
until users click a toggle button. See :ref:`dropdown-admonitions`.
- Collapse arbitrary chunks of content on your page with a ``toggle`` directive.
See :ref:`toggle-directive`.


.. admonition:: For example, click the "+" button to the right:
:class: dropdown
Expand All @@ -26,11 +32,13 @@ For example, click the toggle button to the right just below.

See :ref:`usage` for more information.

.. caution::

``sphinx-togglebutton`` is designed for the
`sphinx-book-theme <https://sphinx-book-theme.readthedocs.io/>`_. It should work
properly on other themes, but if you notice any CSS bugs, please open an issue!
.. admonition:: Check out sphinx-panels as well!
:class: tip

For a bootstrap-based "dropdown" directive that uses pure CSS, check out
`Sphinx Panels <https://sphinx-panels.readthedocs.io/en/latest/#dropdown-usage>`_


Installation
============
Expand Down Expand Up @@ -63,9 +71,15 @@ Usage

There are two main ways to use ``sphinx-togglebutton``:

* Create dropdown admonitions with the ``dropdown`` class
* Make arbitrary chunks of content "toggle-able" with the ``toggle::`` directive
- Collapse admonitions with the ``dropdown`` class
- Make arbitrary chunks of content "toggle-able" with the ``toggle::`` directive

.. caution::

``sphinx-togglebutton`` is designed for the
`sphinx-book-theme <https://sphinx-book-theme.readthedocs.io/>`_. It should work
properly on other themes, but if you notice any CSS bugs, please open an issue!

.. _dropdown-admonitions:

Dropdown admonitions by adding classes
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
setup(
name="sphinx-togglebutton",
version=version,
description="Add a toggle button to items on a page.",
description="Toggle page content and collapse admonitions in Sphinx.",
long_description=readme_text,
long_description_content_type="text/markdown",
author="Chris Holdgraf",
Expand Down