Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jun 6, 2022
1 parent ac51e28 commit 0e28075
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/extdev/nodes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Special nodes
.. autoclass:: only
.. autoclass:: meta
.. autoclass:: highlightlang
.. autoclass:: collapsible

You should not need to generate the nodes below in extensions.

Expand Down
31 changes: 31 additions & 0 deletions doc/usage/restructuredtext/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,37 @@ Including content based on tags
This directive is designed to control only content of document. It could
not control sections, labels and so on.

.. _collapsible:

Using collapsible content
-------------------------

.. rst:directive:: .. collapsible:: <summary description>
For HTML builders, place the content of the directive into a HTML `details
disclosure`_ element, with the *summary description* text included as the
summary for the element. The *summary description* text is parsed as
reStructuredText, and can be broken over multiple lines if required. An
example and the equivalent output are shown below:

.. code-block:: reStructuredText
.. collapsible:: ``literal`` and **bold** content.
This is the body of the directive.
.. collapsible:: ``literal`` and **bold** content.

This is the body of the directive.

Only the HTML 5 output format supports collapsible content. For other builders,
the body of the directive is rendered in the document and the *summary
description* text is ignored.

.. versionadded:: 5.1

.. _details disclosure: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details

.. _table-directives:

Tables
Expand Down

0 comments on commit 0e28075

Please sign in to comment.