DOM macros let you read and modify elements that are already on the page using CSS/jQuery-style selectors. They are the standard way to make targeted, in-place changes to the passage without navigating to a new one.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
Class macros
<<addclass selector classNames>>
Adds one or more space-separated class names to every element matched by the selector.
A CSS/jQuery-style selector string targeting one or more elements.
One or more space-separated class names to add.
<<removeclass selector [classNames]>>
Removes one or more class names from matched elements. If no class names are given, all classes are removed.
A CSS/jQuery-style selector string.
Optional. Space-separated class names to remove. Omit to remove all classes.
<<toggleclass selector classNames>>
Toggles class names on matched elements: adds them if absent, removes them if present.
A CSS/jQuery-style selector string.
One or more space-separated class names to toggle.
Content macros
<<append selector [transition|t8n]>> … <</append>>
Executes its body and appends the output to the end of the matched element’s existing content.
- Without transition
- With transition
A CSS/jQuery-style selector string.
Optional. Applies a CSS transition to the incoming content. The inserted content is wrapped in a
<span> with macro-append-insert and macro-append-in classes.<<prepend selector [transition|t8n]>> … <</prepend>>
Executes its body and prepends the output before the beginning of the matched element’s existing content.
<<replace selector [transition|t8n]>> … <</replace>>
Executes its body and replaces the entire content of the matched element with the output. If the body is empty, the element is emptied (but not removed—use <<remove>> to delete the element itself).
<<copy selector>>
Outputs a copy of the content of the matched element(s) at the current position in the passage. The copy is purely a snapshot of the HTML—interactive elements will generally not function after being copied.
<<remove selector>>
Removes the matched element(s) from the page entirely.
If you want to empty an element rather than delete it, use an empty
<<replace>> instead: <<replace "#target">><</replace>>.Patterns and tips
Selector reference
Selector reference
DOM macros accept any CSS selector jQuery supports:
Using <<done>> for passage-local DOM changes
Using <<done>> for passage-local DOM changes
<<done>> waits until the passage is fully on the page before running, which makes it safe to target elements from the current passage.Toggling themes with <<toggleclass>>
Toggling themes with <<toggleclass>>