Skip to content

Commit 49c3b21

Browse files
timhoffmAA-Turner
andauthored
Format directive options and add some missing ones (#12779)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
1 parent eb6ff0a commit 49c3b21

File tree

1 file changed

+88
-39
lines changed

1 file changed

+88
-39
lines changed

doc/usage/restructuredtext/directives.rst

Lines changed: 88 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The ``toctree`` directive is the central element.
117117
.. versionchanged:: 0.6
118118
Added support for external links and "self" references.
119119

120-
.. rubric:: options
120+
.. rubric:: Options
121121

122122
.. rst:directive:option:: class: class names
123123
:type: a list of class names, separated by spaces
@@ -562,6 +562,27 @@ Presentational
562562
A rubric is like an informal heading that doesn't correspond to the document's structure,
563563
i.e. it does not create a table of contents node.
564564

565+
.. note::
566+
567+
If the *title* of the rubric is "Footnotes" (or the selected language's
568+
equivalent), this rubric is ignored by the LaTeX writer, since it is
569+
assumed to only contain footnote definitions and therefore would create an
570+
empty heading.
571+
572+
.. rubric:: Options
573+
574+
.. rst:directive:option:: class: class names
575+
:type: a list of class names, separated by spaces
576+
577+
Assign `class attributes`_.
578+
This is a :dudir:`common option <common-options>`.
579+
580+
.. rst:directive:option:: name: label
581+
:type: text
582+
583+
An implicit target name that can be referenced using :rst:role:`ref`.
584+
This is a :dudir:`common option <common-options>`.
585+
565586
.. rst:directive:option:: heading-level: n
566587
:type: number from 1 to 6
567588
@@ -572,12 +593,6 @@ Presentational
572593
or as the corresponding non-numbered sectioning command for LaTeX
573594
(see :confval:`latex_toplevel_sectioning`).
574595
575-
.. note::
576-
577-
If the *title* of the rubric is "Footnotes" (or the selected language's
578-
equivalent), this rubric is ignored by the LaTeX writer, since it is
579-
assumed to only contain footnote definitions and therefore would create an
580-
empty heading.
581596
582597
.. rst:directive:: centered
583598
@@ -594,17 +609,22 @@ Presentational
594609
compact list by either distributing more than one item horizontally, or
595610
reducing spacing between items, depending on the builder.
596611

597-
For builders that support the horizontal distribution, there is a ``columns``
598-
option that specifies the number of columns; it defaults to 2. Example::
612+
.. rubric:: Options
613+
614+
.. rst:directive:option:: columns: n
615+
:type: int
616+
617+
The number of columns; defaults to 2.
618+
For example::
599619
600-
.. hlist::
601-
:columns: 3
620+
.. hlist::
621+
:columns: 3
602622
603-
* A list of
604-
* short items
605-
* that should be
606-
* displayed
607-
* horizontally
623+
* A list of
624+
* short items
625+
* that should be
626+
* displayed
627+
* horizontally
608628
609629
.. versionadded:: 0.6
610630

@@ -678,7 +698,7 @@ __ https://pygments.org/docs/lexers
678698
As discussed previously, *language* can be any lexer alias supported by
679699
Pygments.
680700

681-
.. rubric:: options
701+
.. rubric:: Options
682702

683703
.. rst:directive:option:: linenothreshold: threshold
684704
:type: number (optional)
@@ -723,7 +743,7 @@ __ https://pygments.org/docs/lexers
723743
.. versionchanged:: 2.0
724744
The ``language`` argument becomes optional.
725745

726-
.. rubric:: options
746+
.. rubric:: Options
727747

728748
.. rst:directive:option:: linenos
729749
:type: no value
@@ -1050,19 +1070,26 @@ Glossary
10501070
text only have "term" part. In this case, translated "localized term" will be
10511071
categorized in "key" group.
10521072

1053-
.. versionadded:: 0.6
1054-
You can now give the glossary directive a ``:sorted:`` flag that will
1055-
automatically sort the entries alphabetically.
10561073

10571074
.. versionchanged:: 1.1
10581075
Now supports multiple terms and inline markup in terms.
10591076

10601077
.. versionchanged:: 1.4
10611078
Index key for glossary term should be considered *experimental*.
10621079

1063-
.. versionchanged:: 4.4
1064-
In internationalized documentation, the ``:sorted:`` flag sorts
1065-
according to translated terms.
1080+
1081+
.. rubric:: Options
1082+
1083+
.. rst:directive:option:: sorted
1084+
1085+
Sort the entries alphabetically.
1086+
1087+
.. versionadded:: 0.6
1088+
1089+
.. versionchanged:: 4.4
1090+
In internationalized documentation, sort according to translated terms.
1091+
1092+
10661093
10671094
Meta-information markup
10681095
-----------------------
@@ -1211,7 +1238,7 @@ mainly contained in information units, such as the language reference.
12111238
.. versionchanged:: 1.1
12121239
Added ``see`` and ``seealso`` types, as well as marking main entries.
12131240

1214-
.. rubric:: options
1241+
.. rubric:: Options
12151242

12161243
.. rst:directive:option:: name: a label for hyperlink
12171244
:type: text
@@ -1415,23 +1442,45 @@ or use Python raw strings (``r"raw"``).
14151442

14161443
.. math:: (a + b)^2 = a^2 + 2ab + b^2
14171444

1418-
Normally, equations are not numbered. If you want your equation to get a
1419-
number, use the ``label`` option. When given, it selects an internal label
1420-
for the equation, by which it can be cross-referenced, and causes an equation
1421-
number to be issued. See :rst:role:`eq` for an example. The numbering
1422-
style depends on the output format.
1445+
.. rubric:: Options
14231446

1424-
There is also an option ``nowrap`` that prevents any wrapping of the given
1425-
math in a math environment. When you give this option, you must make sure
1426-
yourself that the math is properly set up. For example::
1447+
.. rst:directive:option:: class: class names
1448+
:type: a list of class names, separated by spaces
14271449
1428-
.. math::
1429-
:nowrap:
1450+
Assign `class attributes`_.
1451+
This is a :dudir:`common option <common-options>`.
1452+
1453+
.. _class attributes: https://docutils.sourceforge.io/docs/ref/doctree.html#classes
1454+
1455+
.. rst:directive:option:: name: label
1456+
:type: text
1457+
1458+
An implicit target name that can be referenced using :rst:role:`ref`.
1459+
This is a :dudir:`common option <common-options>`.
1460+
1461+
.. rst:directive:option:: label: label
1462+
:type: text
1463+
1464+
Normally, equations are not numbered. If you want your equation to get a
1465+
number, use the ``label`` option. When given, it selects an internal label
1466+
for the equation, by which it can be cross-referenced, and causes an equation
1467+
number to be issued. See :rst:role:`eq` for an example. The numbering
1468+
style depends on the output format.
1469+
1470+
.. rst:directive:option:: nowrap
1471+
1472+
Prevent wrapping of the given math in a math environment.
1473+
When you give this option, you must make sure
1474+
yourself that the math is properly set up.
1475+
For example::
1476+
1477+
.. math::
1478+
:nowrap:
14301479
1431-
\begin{eqnarray}
1432-
y & = & ax^2 + bx + c \\
1433-
f(x) & = & x^2 + 2xy + y^2
1434-
\end{eqnarray}
1480+
\begin{eqnarray}
1481+
y & = & ax^2 + bx + c \\
1482+
f(x) & = & x^2 + 2xy + y^2
1483+
\end{eqnarray}
14351484
14361485
.. _AmSMath LaTeX package: https://www.ams.org/publications/authors/tex/amslatex
14371486

0 commit comments

Comments
 (0)