collapse¶
This directive hides or unhides a part of the documentation, usually snippets of code. The user can click on a button to fold or unfold a section.
Usage¶
In conf.py:
extensions = [ ...
'sphinx_runpython.collapse',
]
Show or hide a part of the documentation.
Directive¶
- class sphinx_runpython.collapse.sphinx_collapse_extension.CollapseDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]¶
A
collapse
adds hide/unhide button for a part of HTML page. It has no effect in other formats.legend: legend for the button, if not precise, it will be hide / unhide. Example:
:legend: hide/unhide
.hide: the text is shown by default unless this option is set up.
Example:
.. collapse:: :legend: hide/unhide some text to hide or unhide
Which gives:
some text to hide or unhide