General Syntax¶
All directives start with .., then a single space, followed by the name of
the directive, then ::.
Many directives also accept options. Options are indented below the directive
line and begin with ::
Source
.. tb-reveal::
:showlabel: Show answer
:hidelabel: Hide answer
The answer is 42.
Rendered
Show answer
The answer is 42.
Container directives can contain other directives:
Source
.. tb-group::
.. tb-tab:: First tab
Content for the first tab.
.. tb-tab:: Useful forms
Here is a useful summation, along with the closed-form solution:
.. math::
\sum_{k = 1}^{n} k = \frac{n (n+1)}{2}.
Rendered
First tab
Content for the first tab.
Useful forms
Here is a useful summation, along with the closed-form solution:
Common options¶
Every Touchbook directive accepts the optional name and class
parameters as described in
Docutils common option.
If name is omitted, an ID is automatically generated based on the current
document and node position.
This ID is deterministic, but not stable:
if your document changes the generated name may change.
Use an explicit name when you want a stable
human-readable target for references, tests, or custom integration.
.. tb-reveal::
:name: optional-name
Content that can be revealed.
The class parameter takes a space-separated list of class names.
HTML output attaches those classes to the directive’s root tb-* element.
.. tb-reveal::
:class: review-note compact
Content that can be styled with project CSS.
.. tb-code:: python
:class: highlight-override
print("Hello")