The sphinx-collapse
extension enhances Sphinx documentation by introducing collapsible sections.
This feature allows documentation authors to create toggles for hiding and revealing detailed content, making documents more manageable and navigable for readers.
Example:
Hide content
Toggle the visibility of content with a Sphinx directive tailored for this purpose.
Minimal code
The library does not use JavaScript nor relies on third-party frameworks such as Bootstrap, Tailwind CSS, or Foundation.
Configurable
Customize the style of the collapsible directive using options or overriding the CSS.
Install
sphinx-collapse
using PIP.pip install sphinx-collapse
Add the extension to your Sphinx project
conf.py
file.extensions = ['sphinx_collapse']
Add the collapse directive in your reStructuredText content. Here's a basic example:
.. collapse:: Click here
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Example output:
Check out the full documentation for more customizable options at https://sphinx-collapse.readthedocs.io/
We encourage public contributions! Please review CONTRIBUTING for details on our code of conduct and development process.
Copyright (c) 2022 - present David Garcia (@dgarcia360).
Licensed under the MIT License.