xref: /aosp_15_r20/external/pigweed/docs/style/rest.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker============================
4*61c4878aSAndroid Build Coastguard WorkerreStructuredText style guide
5*61c4878aSAndroid Build Coastguard Worker============================
6*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
7*61c4878aSAndroid Build Coastguard Worker.. _reStructuredText: https://docutils.sourceforge.io/rst.html
8*61c4878aSAndroid Build Coastguard Worker.. _Sphinx: https://www.sphinx-doc.org/en/master/
9*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
10*61c4878aSAndroid Build Coastguard Worker
11*61c4878aSAndroid Build Coastguard WorkerThis style guide defines Pigweed's conventions for `reStructuredText`_ (reST).
12*61c4878aSAndroid Build Coastguard Worker``pigweed.dev`` documentation is authored in reST, not Markdown. Pigweed
13*61c4878aSAndroid Build Coastguard Workeruses `Sphinx`_ to convert reST into HTML.
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Worker.. tip:: ``pw format`` detects reST style issues.
16*61c4878aSAndroid Build Coastguard Worker
17*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-overview:
18*61c4878aSAndroid Build Coastguard Worker
19*61c4878aSAndroid Build Coastguard Worker--------
20*61c4878aSAndroid Build Coastguard WorkerOverview
21*61c4878aSAndroid Build Coastguard Worker--------
22*61c4878aSAndroid Build Coastguard Worker
23*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-scope:
24*61c4878aSAndroid Build Coastguard Worker
25*61c4878aSAndroid Build Coastguard WorkerScope
26*61c4878aSAndroid Build Coastguard Worker=====
27*61c4878aSAndroid Build Coastguard WorkerThis style guide applies to all reST markup that's intended to be published to
28*61c4878aSAndroid Build Coastguard Worker``pigweed.dev``. reST markup is mainly found in ``.rst`` files but it's also
29*61c4878aSAndroid Build Coastguard Workerpossible to embed reST within other types of files.
30*61c4878aSAndroid Build Coastguard Worker
31*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-other:
32*61c4878aSAndroid Build Coastguard Worker
33*61c4878aSAndroid Build Coastguard WorkerRelated style guides
34*61c4878aSAndroid Build Coastguard Worker====================
35*61c4878aSAndroid Build Coastguard WorkerThis style guide is narrowly focused on Pigweed's usage of reStructuredText.
36*61c4878aSAndroid Build Coastguard WorkerSee :ref:`docs-contrib-docs` for other aspects of Pigweed documentation style.
37*61c4878aSAndroid Build Coastguard Worker
38*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-headings:
39*61c4878aSAndroid Build Coastguard Worker
40*61c4878aSAndroid Build Coastguard Worker--------
41*61c4878aSAndroid Build Coastguard WorkerHeadings
42*61c4878aSAndroid Build Coastguard Worker--------
43*61c4878aSAndroid Build Coastguard WorkerUse the following syntax for headings.
44*61c4878aSAndroid Build Coastguard Worker
45*61c4878aSAndroid Build Coastguard Worker.. code-block:: rst
46*61c4878aSAndroid Build Coastguard Worker
47*61c4878aSAndroid Build Coastguard Worker   ==================
48*61c4878aSAndroid Build Coastguard Worker   H1: Document title
49*61c4878aSAndroid Build Coastguard Worker   ==================
50*61c4878aSAndroid Build Coastguard Worker   In HTML the heading above is rendered as an H1 node. A page must have
51*61c4878aSAndroid Build Coastguard Worker   exactly one H1 node. The H1 text must have equals signs (``=``) above
52*61c4878aSAndroid Build Coastguard Worker   and below it.
53*61c4878aSAndroid Build Coastguard Worker
54*61c4878aSAndroid Build Coastguard Worker   ------------
55*61c4878aSAndroid Build Coastguard Worker   H2: Sections
56*61c4878aSAndroid Build Coastguard Worker   ------------
57*61c4878aSAndroid Build Coastguard Worker   In HTML the heading above is rendered as an H2 node. The H2 text must have
58*61c4878aSAndroid Build Coastguard Worker   minus signs (``-``) above and below it. H2 headings are conceptually similar
59*61c4878aSAndroid Build Coastguard Worker   to chapters in a book.
60*61c4878aSAndroid Build Coastguard Worker
61*61c4878aSAndroid Build Coastguard Worker   H3: Subsections
62*61c4878aSAndroid Build Coastguard Worker   ===============
63*61c4878aSAndroid Build Coastguard Worker   In HTML the heading above is rendered as an H3 node. The H3 text must
64*61c4878aSAndroid Build Coastguard Worker   have equals signs (``=``) below it. H3 headings are conceptually similar to
65*61c4878aSAndroid Build Coastguard Worker   sections within a chapter of a book.
66*61c4878aSAndroid Build Coastguard Worker
67*61c4878aSAndroid Build Coastguard Worker   H4: Subsubsections
68*61c4878aSAndroid Build Coastguard Worker   ------------------
69*61c4878aSAndroid Build Coastguard Worker   In HTML the heading above is rendered as an H4 node. The H4 text must have
70*61c4878aSAndroid Build Coastguard Worker   minus signs (``-``) below it. H4 headings are used rarely.
71*61c4878aSAndroid Build Coastguard Worker
72*61c4878aSAndroid Build Coastguard Worker   H5: Subsubsubsections
73*61c4878aSAndroid Build Coastguard Worker   ^^^^^^^^^^^^^^^^^^^^^
74*61c4878aSAndroid Build Coastguard Worker   In HTML the heading above is rendered as an H5 node. The H5 text must have
75*61c4878aSAndroid Build Coastguard Worker   caret symbols (``^``) below it. H5 headings are used very rarely.
76*61c4878aSAndroid Build Coastguard Worker
77*61c4878aSAndroid Build Coastguard Worker   H6: Subsubsubsubsections
78*61c4878aSAndroid Build Coastguard Worker   ........................
79*61c4878aSAndroid Build Coastguard Worker   In HTML the heading above is rendered as an H6 node. The H6 text must have
80*61c4878aSAndroid Build Coastguard Worker   period symbols (``.``) below it. H6 headings are practically never used and
81*61c4878aSAndroid Build Coastguard Worker   are an indicator that a document probably needs refactoring.
82*61c4878aSAndroid Build Coastguard Worker
83*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-headings-order:
84*61c4878aSAndroid Build Coastguard Worker
85*61c4878aSAndroid Build Coastguard WorkerHeading levels
86*61c4878aSAndroid Build Coastguard Worker==============
87*61c4878aSAndroid Build Coastguard WorkerHeadings must be used in hierarchical order. No level can be skipped. For
88*61c4878aSAndroid Build Coastguard Workerexample, you can't use an H1 heading followed by an H3. See
89*61c4878aSAndroid Build Coastguard Worker`Headings and titles <https://developers.google.com/style/accessibility#headings-and-titles>`_.
90*61c4878aSAndroid Build Coastguard Worker
91*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-headings-whitespace-after:
92*61c4878aSAndroid Build Coastguard Worker
93*61c4878aSAndroid Build Coastguard WorkerNo blank lines after headings
94*61c4878aSAndroid Build Coastguard Worker=============================
95*61c4878aSAndroid Build Coastguard WorkerDon't put whitespace between a heading and the content that follows it.
96*61c4878aSAndroid Build Coastguard Worker
97*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
98*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
99*61c4878aSAndroid Build Coastguard Worker
100*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
101*61c4878aSAndroid Build Coastguard Worker
102*61c4878aSAndroid Build Coastguard Worker      Example heading
103*61c4878aSAndroid Build Coastguard Worker      ===============
104*61c4878aSAndroid Build Coastguard Worker      This paragraph is positioned correctly.
105*61c4878aSAndroid Build Coastguard Worker
106*61c4878aSAndroid Build Coastguard Worker.. admonition:: **No**
107*61c4878aSAndroid Build Coastguard Worker   :class: error
108*61c4878aSAndroid Build Coastguard Worker
109*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
110*61c4878aSAndroid Build Coastguard Worker
111*61c4878aSAndroid Build Coastguard Worker      Example heading
112*61c4878aSAndroid Build Coastguard Worker      ===============
113*61c4878aSAndroid Build Coastguard Worker
114*61c4878aSAndroid Build Coastguard Worker      This paragraph isn't positioned correctly. There shouldn't be a blank
115*61c4878aSAndroid Build Coastguard Worker      line above it.
116*61c4878aSAndroid Build Coastguard Worker
117*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-headings-whitespace-before:
118*61c4878aSAndroid Build Coastguard Worker
119*61c4878aSAndroid Build Coastguard WorkerOne blank line before a heading
120*61c4878aSAndroid Build Coastguard Worker===============================
121*61c4878aSAndroid Build Coastguard WorkerPut one blank line between a heading and the content that comes before it.
122*61c4878aSAndroid Build Coastguard Worker
123*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
124*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
125*61c4878aSAndroid Build Coastguard Worker
126*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
127*61c4878aSAndroid Build Coastguard Worker
128*61c4878aSAndroid Build Coastguard Worker      This paragraph is positioned correctly.
129*61c4878aSAndroid Build Coastguard Worker
130*61c4878aSAndroid Build Coastguard Worker      Example heading
131*61c4878aSAndroid Build Coastguard Worker      ---------------
132*61c4878aSAndroid Build Coastguard Worker      ...
133*61c4878aSAndroid Build Coastguard Worker
134*61c4878aSAndroid Build Coastguard Worker.. admonition:: **No**
135*61c4878aSAndroid Build Coastguard Worker   :class: error
136*61c4878aSAndroid Build Coastguard Worker
137*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
138*61c4878aSAndroid Build Coastguard Worker
139*61c4878aSAndroid Build Coastguard Worker      This paragraph isn't positioned correctly. There's too much whitespace
140*61c4878aSAndroid Build Coastguard Worker      below it.
141*61c4878aSAndroid Build Coastguard Worker
142*61c4878aSAndroid Build Coastguard Worker
143*61c4878aSAndroid Build Coastguard Worker
144*61c4878aSAndroid Build Coastguard Worker      Example heading
145*61c4878aSAndroid Build Coastguard Worker      ---------------
146*61c4878aSAndroid Build Coastguard Worker      ...
147*61c4878aSAndroid Build Coastguard Worker
148*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-directives:
149*61c4878aSAndroid Build Coastguard Worker
150*61c4878aSAndroid Build Coastguard Worker----------
151*61c4878aSAndroid Build Coastguard WorkerDirectives
152*61c4878aSAndroid Build Coastguard Worker----------
153*61c4878aSAndroid Build Coastguard WorkerIndent directive content and attributes 3 spaces so that they align
154*61c4878aSAndroid Build Coastguard Workerwith the directive name.
155*61c4878aSAndroid Build Coastguard Worker
156*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
157*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
158*61c4878aSAndroid Build Coastguard Worker
159*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
160*61c4878aSAndroid Build Coastguard Worker
161*61c4878aSAndroid Build Coastguard Worker      .. my-directive::
162*61c4878aSAndroid Build Coastguard Worker         :my-attr: This attribute is positioned correctly.
163*61c4878aSAndroid Build Coastguard Worker
164*61c4878aSAndroid Build Coastguard Worker         This paragraph is positioned correctly.
165*61c4878aSAndroid Build Coastguard Worker
166*61c4878aSAndroid Build Coastguard Worker         .. my-nested-directive::
167*61c4878aSAndroid Build Coastguard Worker
168*61c4878aSAndroid Build Coastguard Worker            This paragraph is positioned correctly.
169*61c4878aSAndroid Build Coastguard Worker
170*61c4878aSAndroid Build Coastguard Worker.. admonition:: **No**
171*61c4878aSAndroid Build Coastguard Worker   :class: error
172*61c4878aSAndroid Build Coastguard Worker
173*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
174*61c4878aSAndroid Build Coastguard Worker
175*61c4878aSAndroid Build Coastguard Worker      .. my-directive::
176*61c4878aSAndroid Build Coastguard Worker
177*61c4878aSAndroid Build Coastguard Worker        This paragraph isn't positioned correctly. It has too few spaces.
178*61c4878aSAndroid Build Coastguard Worker
179*61c4878aSAndroid Build Coastguard Worker      .. my-directive::
180*61c4878aSAndroid Build Coastguard Worker
181*61c4878aSAndroid Build Coastguard Worker          This paragraph isn't positioned correctly. It has too many spaces.
182*61c4878aSAndroid Build Coastguard Worker
183*61c4878aSAndroid Build Coastguard WorkerPut a blank line between the directive and its content. Don't put space
184*61c4878aSAndroid Build Coastguard Workerbetween a directive name and its attributes.
185*61c4878aSAndroid Build Coastguard Worker
186*61c4878aSAndroid Build Coastguard Worker.. admonition:: **Yes**
187*61c4878aSAndroid Build Coastguard Worker   :class: checkmark
188*61c4878aSAndroid Build Coastguard Worker
189*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
190*61c4878aSAndroid Build Coastguard Worker
191*61c4878aSAndroid Build Coastguard Worker      .. my-directive::
192*61c4878aSAndroid Build Coastguard Worker         :my-attr: This attribute is positioned correctly.
193*61c4878aSAndroid Build Coastguard Worker
194*61c4878aSAndroid Build Coastguard Worker         This paragraph is positioned correctly.
195*61c4878aSAndroid Build Coastguard Worker
196*61c4878aSAndroid Build Coastguard Worker.. admonition:: **No**
197*61c4878aSAndroid Build Coastguard Worker   :class: error
198*61c4878aSAndroid Build Coastguard Worker
199*61c4878aSAndroid Build Coastguard Worker   .. code-block:: rst
200*61c4878aSAndroid Build Coastguard Worker
201*61c4878aSAndroid Build Coastguard Worker      .. my-directive::
202*61c4878aSAndroid Build Coastguard Worker         This paragraph isn't positioned correctly. There should be a blank
203*61c4878aSAndroid Build Coastguard Worker         line above it.
204*61c4878aSAndroid Build Coastguard Worker
205*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-tables:
206*61c4878aSAndroid Build Coastguard Worker
207*61c4878aSAndroid Build Coastguard Worker------
208*61c4878aSAndroid Build Coastguard WorkerTables
209*61c4878aSAndroid Build Coastguard Worker------
210*61c4878aSAndroid Build Coastguard Worker.. _csv-table: https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table-1
211*61c4878aSAndroid Build Coastguard Worker.. _list-table: https://docutils.sourceforge.io/docs/ref/rst/directives.html#list-table
212*61c4878aSAndroid Build Coastguard Worker.. _table: https://docutils.sourceforge.io/docs/ref/rst/directives.html#table
213*61c4878aSAndroid Build Coastguard Worker
214*61c4878aSAndroid Build Coastguard WorkerPrefer `list-table`_ and `csv-table`_. Avoid `table`_. ``list-table`` and
215*61c4878aSAndroid Build Coastguard Worker``csv-table`` are easier to maintain.
216*61c4878aSAndroid Build Coastguard Worker
217*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-includes:
218*61c4878aSAndroid Build Coastguard Worker
219*61c4878aSAndroid Build Coastguard Worker-------------
220*61c4878aSAndroid Build Coastguard WorkerCode includes
221*61c4878aSAndroid Build Coastguard Worker-------------
222*61c4878aSAndroid Build Coastguard WorkerPrefer including code snippets from actual source code files that are built
223*61c4878aSAndroid Build Coastguard Workerand tested regularly.
224*61c4878aSAndroid Build Coastguard Worker
225*61c4878aSAndroid Build Coastguard WorkerTo include a portion of a file:
226*61c4878aSAndroid Build Coastguard Worker
227*61c4878aSAndroid Build Coastguard Worker.. code-block:: rst
228*61c4878aSAndroid Build Coastguard Worker
229*61c4878aSAndroid Build Coastguard Worker   .. literalinclude:: my_source_file.py
230*61c4878aSAndroid Build Coastguard Worker      :start-after: my-start-text
231*61c4878aSAndroid Build Coastguard Worker      :end-before: my-end-text
232*61c4878aSAndroid Build Coastguard Worker
233*61c4878aSAndroid Build Coastguard Worker``my-start-text`` and ``my-end-text`` are the exclusive delimiters that must
234*61c4878aSAndroid Build Coastguard Workerappear verbatim in the source file.
235*61c4878aSAndroid Build Coastguard Worker
236*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-includes-python:
237*61c4878aSAndroid Build Coastguard Worker
238*61c4878aSAndroid Build Coastguard WorkerPython code includes
239*61c4878aSAndroid Build Coastguard Worker====================
240*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
241*61c4878aSAndroid Build Coastguard Worker.. _autodoc: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directives
242*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
243*61c4878aSAndroid Build Coastguard Worker
244*61c4878aSAndroid Build Coastguard WorkerUse `autodoc`_.
245*61c4878aSAndroid Build Coastguard Worker
246*61c4878aSAndroid Build Coastguard WorkerPython code includes for CLI args
247*61c4878aSAndroid Build Coastguard Worker---------------------------------
248*61c4878aSAndroid Build Coastguard WorkerUse `argparse <https://sphinx-argparse.readthedocs.io/en/latest/usage.html>`_.
249*61c4878aSAndroid Build Coastguard Worker
250*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-code-blocks:
251*61c4878aSAndroid Build Coastguard Worker
252*61c4878aSAndroid Build Coastguard Worker-----------
253*61c4878aSAndroid Build Coastguard WorkerCode blocks
254*61c4878aSAndroid Build Coastguard Worker-----------
255*61c4878aSAndroid Build Coastguard Worker.. _Languages: https://pygments.org/languages/
256*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
257*61c4878aSAndroid Build Coastguard Worker.. _code-block: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block
258*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
259*61c4878aSAndroid Build Coastguard Worker
260*61c4878aSAndroid Build Coastguard WorkerUse `code-block`_. See `Languages`_ for the list of valid language
261*61c4878aSAndroid Build Coastguard Workerkeywords.
262*61c4878aSAndroid Build Coastguard Worker
263*61c4878aSAndroid Build Coastguard WorkerIf Google has a style guide for the programming language in your code block,
264*61c4878aSAndroid Build Coastguard Workeryour code should match Google's style guide.
265*61c4878aSAndroid Build Coastguard Worker
266*61c4878aSAndroid Build Coastguard Worker.. code-block:: rst
267*61c4878aSAndroid Build Coastguard Worker
268*61c4878aSAndroid Build Coastguard Worker   .. code-block:: c++
269*61c4878aSAndroid Build Coastguard Worker
270*61c4878aSAndroid Build Coastguard Worker      // ...
271*61c4878aSAndroid Build Coastguard Worker
272*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-toc:
273*61c4878aSAndroid Build Coastguard Worker
274*61c4878aSAndroid Build Coastguard Worker-------------------------------------
275*61c4878aSAndroid Build Coastguard WorkerTable of contents depth customization
276*61c4878aSAndroid Build Coastguard Worker-------------------------------------
277*61c4878aSAndroid Build Coastguard WorkerPut ``:tocdepth: X`` on the first line of the page, where ``X`` equals how many
278*61c4878aSAndroid Build Coastguard Workerlevels of section heading you want to show in the page's table of contents. See
279*61c4878aSAndroid Build Coastguard Worker``//docs/changelog.rst`` for an example.
280*61c4878aSAndroid Build Coastguard Worker
281*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-cta:
282*61c4878aSAndroid Build Coastguard Worker
283*61c4878aSAndroid Build Coastguard Worker----------------------
284*61c4878aSAndroid Build Coastguard WorkerCall-to-action buttons
285*61c4878aSAndroid Build Coastguard Worker----------------------
286*61c4878aSAndroid Build Coastguard WorkerUse ``grid`` and ``grid-item-card``.
287*61c4878aSAndroid Build Coastguard Worker
288*61c4878aSAndroid Build Coastguard Worker.. code-block::
289*61c4878aSAndroid Build Coastguard Worker
290*61c4878aSAndroid Build Coastguard Worker   .. grid:: 2
291*61c4878aSAndroid Build Coastguard Worker
292*61c4878aSAndroid Build Coastguard Worker      .. grid-item-card:: :octicon:`<ICON>` <TITLE>
293*61c4878aSAndroid Build Coastguard Worker         :link: <REF>
294*61c4878aSAndroid Build Coastguard Worker         :link-type: <TYPE>
295*61c4878aSAndroid Build Coastguard Worker         :class-item: <CLASS>
296*61c4878aSAndroid Build Coastguard Worker
297*61c4878aSAndroid Build Coastguard Worker         <DESCRIPTION>
298*61c4878aSAndroid Build Coastguard Worker
299*61c4878aSAndroid Build Coastguard Worker.. _Octicons: https://primer.style/foundations/icons
300*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: disable
301*61c4878aSAndroid Build Coastguard Worker.. _ref: https://www.sphinx-doc.org/en/master/usage/referencing.html#ref-role
302*61c4878aSAndroid Build Coastguard Worker.. inclusive-language: enable
303*61c4878aSAndroid Build Coastguard Worker
304*61c4878aSAndroid Build Coastguard Worker* See `Octicons`_ for the list of valid ``<ICON>`` values.
305*61c4878aSAndroid Build Coastguard Worker* ``<REF>`` can either be a `ref`_ or a full URL.
306*61c4878aSAndroid Build Coastguard Worker* ``<TYPE>`` must be either ``ref`` or ``url``.
307*61c4878aSAndroid Build Coastguard Worker* ``<CLASS>`` must be either ``sales-pitch-cta-primary`` or
308*61c4878aSAndroid Build Coastguard Worker  ``sales-pitch-cta-secondary``. The top-left or top card should use
309*61c4878aSAndroid Build Coastguard Worker  ``sales-pitch-cta-primary``; all the others should use
310*61c4878aSAndroid Build Coastguard Worker  ``sales-pitch-cta-secondary``. The motivation is to draw extra attention to
311*61c4878aSAndroid Build Coastguard Worker  the primary card.
312*61c4878aSAndroid Build Coastguard Worker* ``<DESCRIPTION>`` should be reStructuredText describing what kind of
313*61c4878aSAndroid Build Coastguard Worker  content you'll see if you click the card.
314*61c4878aSAndroid Build Coastguard Worker
315*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-tabs:
316*61c4878aSAndroid Build Coastguard Worker
317*61c4878aSAndroid Build Coastguard Worker----
318*61c4878aSAndroid Build Coastguard WorkerTabs
319*61c4878aSAndroid Build Coastguard Worker----
320*61c4878aSAndroid Build Coastguard Worker.. _Tabs: https://sphinx-design.readthedocs.io/en/furo-theme/tabs.html
321*61c4878aSAndroid Build Coastguard Worker
322*61c4878aSAndroid Build Coastguard WorkerUse ``tab-set`` and ``tab-item``. See `Tabs`_.
323*61c4878aSAndroid Build Coastguard Worker
324*61c4878aSAndroid Build Coastguard Worker.. code-block:: rst
325*61c4878aSAndroid Build Coastguard Worker
326*61c4878aSAndroid Build Coastguard Worker   .. tab-set::
327*61c4878aSAndroid Build Coastguard Worker
328*61c4878aSAndroid Build Coastguard Worker      .. tab-item:: Linux
329*61c4878aSAndroid Build Coastguard Worker
330*61c4878aSAndroid Build Coastguard Worker         Linux instructions...
331*61c4878aSAndroid Build Coastguard Worker
332*61c4878aSAndroid Build Coastguard Worker      .. tab-item:: Windows
333*61c4878aSAndroid Build Coastguard Worker
334*61c4878aSAndroid Build Coastguard Worker         Windows instructions...
335*61c4878aSAndroid Build Coastguard Worker
336*61c4878aSAndroid Build Coastguard WorkerRendered output:
337*61c4878aSAndroid Build Coastguard Worker
338*61c4878aSAndroid Build Coastguard Worker.. tab-set::
339*61c4878aSAndroid Build Coastguard Worker
340*61c4878aSAndroid Build Coastguard Worker   .. tab-item:: Linux
341*61c4878aSAndroid Build Coastguard Worker
342*61c4878aSAndroid Build Coastguard Worker      Linux instructions...
343*61c4878aSAndroid Build Coastguard Worker
344*61c4878aSAndroid Build Coastguard Worker   .. tab-item:: Windows
345*61c4878aSAndroid Build Coastguard Worker
346*61c4878aSAndroid Build Coastguard Worker      Windows instructions...
347*61c4878aSAndroid Build Coastguard Worker
348*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-tabs-code:
349*61c4878aSAndroid Build Coastguard Worker
350*61c4878aSAndroid Build Coastguard WorkerTabs for code-only content
351*61c4878aSAndroid Build Coastguard Worker==========================
352*61c4878aSAndroid Build Coastguard WorkerUse ``tab-set-code``. See `Languages`_ for the list of
353*61c4878aSAndroid Build Coastguard Workervalid language keywords.
354*61c4878aSAndroid Build Coastguard Worker
355*61c4878aSAndroid Build Coastguard Worker.. code-block:: rst
356*61c4878aSAndroid Build Coastguard Worker
357*61c4878aSAndroid Build Coastguard Worker   .. tab-set-code::
358*61c4878aSAndroid Build Coastguard Worker
359*61c4878aSAndroid Build Coastguard Worker      .. code-block:: c++
360*61c4878aSAndroid Build Coastguard Worker
361*61c4878aSAndroid Build Coastguard Worker         // C++ code...
362*61c4878aSAndroid Build Coastguard Worker
363*61c4878aSAndroid Build Coastguard Worker      .. code-block:: python
364*61c4878aSAndroid Build Coastguard Worker
365*61c4878aSAndroid Build Coastguard Worker         # Python code...
366*61c4878aSAndroid Build Coastguard Worker
367*61c4878aSAndroid Build Coastguard WorkerRendered output:
368*61c4878aSAndroid Build Coastguard Worker
369*61c4878aSAndroid Build Coastguard Worker.. tab-set-code::
370*61c4878aSAndroid Build Coastguard Worker
371*61c4878aSAndroid Build Coastguard Worker   .. code-block:: c++
372*61c4878aSAndroid Build Coastguard Worker
373*61c4878aSAndroid Build Coastguard Worker      // C++ code...
374*61c4878aSAndroid Build Coastguard Worker
375*61c4878aSAndroid Build Coastguard Worker   .. code-block:: python
376*61c4878aSAndroid Build Coastguard Worker
377*61c4878aSAndroid Build Coastguard Worker      # Python code...
378*61c4878aSAndroid Build Coastguard Worker
379*61c4878aSAndroid Build Coastguard Worker.. _docs-style-rest-tabs-sync:
380*61c4878aSAndroid Build Coastguard Worker
381*61c4878aSAndroid Build Coastguard WorkerTab synchronization
382*61c4878aSAndroid Build Coastguard Worker===================
383*61c4878aSAndroid Build Coastguard WorkerUse the ``:sync:`` attribute to synchronize tabs for non-code content. See
384*61c4878aSAndroid Build Coastguard Worker**Rendered output** below for an example.
385*61c4878aSAndroid Build Coastguard Worker
386*61c4878aSAndroid Build Coastguard Worker``tab-set-code`` tabs automatically synchronize by code language.
387*61c4878aSAndroid Build Coastguard Worker
388*61c4878aSAndroid Build Coastguard Worker.. code-block:: rst
389*61c4878aSAndroid Build Coastguard Worker
390*61c4878aSAndroid Build Coastguard Worker   .. tab-set::
391*61c4878aSAndroid Build Coastguard Worker
392*61c4878aSAndroid Build Coastguard Worker      .. tab-item:: Linux
393*61c4878aSAndroid Build Coastguard Worker         :sync: linux
394*61c4878aSAndroid Build Coastguard Worker
395*61c4878aSAndroid Build Coastguard Worker         Linux instructions...
396*61c4878aSAndroid Build Coastguard Worker
397*61c4878aSAndroid Build Coastguard Worker      .. tab-item:: Windows
398*61c4878aSAndroid Build Coastguard Worker         :sync: windows
399*61c4878aSAndroid Build Coastguard Worker
400*61c4878aSAndroid Build Coastguard Worker         Windows instructions...
401*61c4878aSAndroid Build Coastguard Worker
402*61c4878aSAndroid Build Coastguard Worker   .. tab-set::
403*61c4878aSAndroid Build Coastguard Worker
404*61c4878aSAndroid Build Coastguard Worker      .. tab-item:: Linux
405*61c4878aSAndroid Build Coastguard Worker         :sync: linux
406*61c4878aSAndroid Build Coastguard Worker
407*61c4878aSAndroid Build Coastguard Worker         More Linux instructions...
408*61c4878aSAndroid Build Coastguard Worker
409*61c4878aSAndroid Build Coastguard Worker      .. tab-item:: Windows
410*61c4878aSAndroid Build Coastguard Worker         :sync: windows
411*61c4878aSAndroid Build Coastguard Worker
412*61c4878aSAndroid Build Coastguard Worker         More Windows instructions...
413*61c4878aSAndroid Build Coastguard Worker
414*61c4878aSAndroid Build Coastguard WorkerRendered output:
415*61c4878aSAndroid Build Coastguard Worker
416*61c4878aSAndroid Build Coastguard Worker.. tab-set::
417*61c4878aSAndroid Build Coastguard Worker
418*61c4878aSAndroid Build Coastguard Worker   .. tab-item:: Linux
419*61c4878aSAndroid Build Coastguard Worker      :sync: linux
420*61c4878aSAndroid Build Coastguard Worker
421*61c4878aSAndroid Build Coastguard Worker      Linux instructions...
422*61c4878aSAndroid Build Coastguard Worker
423*61c4878aSAndroid Build Coastguard Worker   .. tab-item:: Windows
424*61c4878aSAndroid Build Coastguard Worker      :sync: windows
425*61c4878aSAndroid Build Coastguard Worker
426*61c4878aSAndroid Build Coastguard Worker      Windows instructions...
427*61c4878aSAndroid Build Coastguard Worker
428*61c4878aSAndroid Build Coastguard Worker.. tab-set::
429*61c4878aSAndroid Build Coastguard Worker
430*61c4878aSAndroid Build Coastguard Worker   .. tab-item:: Linux
431*61c4878aSAndroid Build Coastguard Worker      :sync: linux
432*61c4878aSAndroid Build Coastguard Worker
433*61c4878aSAndroid Build Coastguard Worker      More Linux instructions...
434*61c4878aSAndroid Build Coastguard Worker
435*61c4878aSAndroid Build Coastguard Worker   .. tab-item:: Windows
436*61c4878aSAndroid Build Coastguard Worker      :sync: windows
437*61c4878aSAndroid Build Coastguard Worker
438*61c4878aSAndroid Build Coastguard Worker      More Windows instructions...
439