Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add collapse and tab examples to guides/contributing.rst #4359

Merged
merged 12 commits into from
Oct 21, 2024
162 changes: 161 additions & 1 deletion guides/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
# Start web server on port 8000
make live-html

Notes
s
kbx81 marked this conversation as resolved.
Show resolved Hide resolved
*****

- Use the English language (duh...)
Expand Down Expand Up @@ -251,6 +251,166 @@

Note that a blank line is *required* after every ``code-block`` directive.

- **Collapsible section**: To add a collapsible section, use the ``collapse`` directive:

.. code-block:: rst

.. collapse:: Details

Something small enough to escape casual notice.

.. collapse:: Details

Something small enough to escape casual notice.

.. code-block:: rst

.. collapse:: Open
:open:

This section is open by default.

.. collapse:: Open
:open:

This section is open by default.

.. code-block:: rst

.. collapse:: A long code block

.. code-block:: yaml

# Sample configuration entry
switch:
- platform: gpio
name: "Relay #42"
pin: GPIOXX

.. collapse:: A long code block

.. code-block:: yaml

# Sample configuration entry
switch:
- platform: gpio
name: "Relay #42"
pin: GPIOXX

.. note::

- The ``:open:`` flag has to be immediately after the ``collapse`` directive without a blank line.
kbx81 marked this conversation as resolved.
Show resolved Hide resolved
- A blank line is *required* after every ``collapse`` directive.

- **Tabs**: To group content into tabs, use the ``tabs`` directive. The tabs directive to define a tab set.
kbx81 marked this conversation as resolved.
Show resolved Hide resolved
Basic tabs are added using the ``tab`` directive (without s), which takes the tab’s label as an argument:

.. code-block:: rst

.. tabs::

.. tab:: Apples

Apples are green, or sometimes red.

Check failure on line 314 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:314

.. tab:: Pears

Pears are green.

Check failure on line 318 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:318

.. tab:: Oranges

Oranges are orange.

Check failure on line 322 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:322

This will appear as

.. tabs::

.. tab:: Apples

Apples are green, or sometimes red.

Check failure on line 330 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:330

.. tab:: Pears

Pears are green.

Check failure on line 334 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:334

.. tab:: Oranges

Oranges are orange.

Check failure on line 338 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:338

The contents of each tab can be displayed by clicking on the tab that you wish to show.
Clicking on the tab that is currently open will hide the tab’s content, leaving only the tab set labels visible.

Tabs can also be nested inside one another:

.. code-block:: rst

.. tabs::

.. tab:: Stars

.. tabs::

Check failure on line 351 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:351

.. tab:: The Sun

The closest star to us.

Check failure on line 355 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:355

.. tab:: Proxima Centauri

The second closest star to us.

Check failure on line 359 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:359

.. tab:: Polaris

The North Star.

Check failure on line 363 in guides/contributing.rst

View workflow job for this annotation

GitHub Actions / build

Directive 'tab' must be indented with 4 spaces, not 2. See guides/contributing.rst:363

.. tab:: Moons

.. tabs::

.. tab:: The Moon

Orbits the Earth

.. tab:: Titan

Orbits Jupiter

.. tabs::

.. tab:: Stars

.. tabs::

.. tab:: The Sun

The closest star to us.

.. tab:: Proxima Centauri

The second closest star to us.

.. tab:: Polaris

The North Star.

.. tab:: Moons

.. tabs::

.. tab:: The Moon

Orbits the Earth

.. tab:: Titan

Orbits Jupiter

.. note::

- A blank line is *required* after every ``tabs`` directive.
- The contents of each tab can be displayed by clicking on the tab that you wish to show.
Clicking on the tab that is currently open will hide the tab’s content, leaving only the tab set labels visible.
- For advanced features like tab-groupings refer to https://sphinx-tabs.readthedocs.io/en/latest/
shvmm marked this conversation as resolved.
Show resolved Hide resolved

- **Images**: Use the ``figure`` directive to display an image:

.. code-block:: rst
Expand Down