Tea passages are written in a wiki-style markup language inherited from SugarCube 2. The parser converts this lightweight syntax into HTML before display, so you can write rich, formatted story content without typing raw HTML for every element. All markup described here has been available since v2.0.0 unless otherwise noted.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.
Naked variable output
Variables in passage text are interpolated automatically — you do not need a print macro for simple values. The following forms are supported:| Type | Syntax | Example |
|---|---|---|
| Simple variable | $variable | $name |
| Property access, dot notation | $variable.property | $thing.name |
| Index access, square bracket notation | $variable[numericIndex] | $thing[0] |
| Property access, square bracket notation | $variable["property"] | $thing["name"] |
| Variable index | $variable[$indexVar] | $thing[$member] |
For anything more complex than a simple lookup — such as a calculation
$variable[_i + 1] or a method call $variable.someMethod() — use a print macro (<<print>>, <<= >>, or <<- >>).Link markup
SugarCube’s link markup has a requiredLink component and optional Text and Setter components. The Link component may be a passage name or any valid URL. The optional Setter component runs when the link is clicked, accepting the same expression syntax as <<set>>.
In addition to the standard pipe separator (|), Tea supports arrow separators -> and <-. The arrow always points at the Link component: Text->Link and Link<-Text.
The following examples assume
$go is "Grocery" and $show is "Go buy milk".- Basic link
- Text | Link
- Link with setter
- Text | Link with setter
Image markup
Image markup has a requiredImage component and optional Text (alt text), Link, and Setter components. The Image value may be a URL or the name of a media (image) passage.
The following examples assume
$src is home.png, $go is "Home", and $show is "Go home".- Image only
- Alt text
- Linked image
- Linked with setter
Image component — may also be used inside stylesheets to reference media passages:
HTML & SVG attribute markup
Tea provides special HTML and SVG attributes and evaluation directives that you can attach to tags for special behaviors.Special attributes
Thedata-passage attribute turns standard HTML elements into passage links or media sources, and data-setter runs a TwineScript expression when the element is activated.
Attribute evaluation directive
Thesc-eval: prefix (or its shorthand @) causes an attribute’s value to be evaluated as TwineScript before the attribute is applied. The directive prefix is removed in the final HTML output.
The evaluation directive cannot be used on
data-setter, since that attribute already evaluates its contents on element activation.Line continuation
A backslash (\) at the start or end of a line removes the associated line break and all whitespace between the backslash and the neighboring text. This is useful for wrapping long lines in your editor without introducing unwanted whitespace in the output.
Headings
An exclamation point (!) at the start of a line creates a heading. Additional exclamation points create lower-level headings, down to level 6.
<h1> through <h6> respectively.
Style markup
Tea provides inline wrappers for common text styles. Each style uses the same token to open and close it.| Type | Syntax | Renders as |
|---|---|---|
| Emphasis (italic) | //Emphasis// | <em>Emphasis</em> |
| Strong (bold) | ''Strong'' | <strong>Strong</strong> |
| Underline | __Underline__ | <u>Underline</u> |
| Strikethrough | ==Strikethrough== | <s>Strikethrough</s> |
| Superscript | Super^^script^^ | Super<sup>script</sup> |
| Subscript | Sub~~script~~ | Sub<sub>script</sub> |
Lists
An asterisk (*) at the start of a line creates an unordered list item. A number sign (#) creates an ordered list item.
Blockquote
A right angle bracket (>) at the start of a line creates a blockquote. Additional brackets create nested blockquotes.
Code markup
Triple curly braces wrap inline or block code. Inline usage wraps the content in<code>. Block usage (opening {{{ on its own line) wraps the content in <pre><code>.
Horizontal rule
Four or more hyphens (-) on a line by themselves produce an <hr> element.
Verbatim text
The verbatim text markup disables all SugarCube and HTML processing for its contents, passing them through as plain text.| Syntax | Example |
|---|---|
| Triple double-quotes | """No //format//""" |
<nowiki> tag | <nowiki>No //format//</nowiki> |
Verbatim HTML
Wrapping content in<html>…</html> passes its contents directly to the browser as raw HTML, bypassing all of Tea’s special attribute and directive processing.
You should virtually never need verbatim HTML markup. Use the normal passage HTML support and Tea’s attribute directives instead.
Custom style markup
The@@ markup applies inline CSS, IDs, or class names to a span of text (inline) or a block of text (block form with a newline after the style list).
The style list before the first ; separator may contain any combination of:
- A single hash-prefixed ID — e.g.,
#alfa - Dot-prefixed class names — e.g.,
.bravo - CSS properties — e.g.,
color:red
Template markup
Templates are text-replacement patterns defined with theTemplate API. In passage text, a template is written as a question mark followed by the template name — e.g., ?He, ?his. When processed, the engine calls the registered function or picks a random member from the registered array.
Template markup was introduced in v2.29.0. Templates are registered via the
Template API.Comments
Comments are stripped from output and never shown to players.| Type | Syntax | Supported in |
|---|---|---|
| C-style block | /* This is a comment. */ | Passage markup, JavaScript, stylesheets |
| HTML block | <!-- This is a comment. --> | Passage markup |
C-style block comments inside scripting contexts — such as
<<script>> or <<set>> macros — are left for the JavaScript engine to handle rather than stripped by Tea’s parser.