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.
Passage instances represent individual passages in the compiled story. They are returned by Story.get() and can also be iterated over via Story.filter() and Story.find(). All properties are effectively read-only — mutating them may produce undefined behavior.
You do not construct
Passage objects directly. Always obtain them through Story.get(), Story.filter(), or Story.find().Getters
<Passage>.id
The passage’s DOM-compatible ID, prefixed with
"passage-" and derived by slugifying the passage name."passage-" + createSlug(name).
<Passage>.name
The human-readable name of the passage, with HTML entities decoded.
<Passage>.tags
A frozen, deduplicated array of the passage’s tag strings.
Passage is constructed.
<Passage>.text
The raw, unprocessed TwineScript text of the passage.
\r characters stripped for Twine 2). If the passage does not exist in the store (i.e., the Passage was constructed from a missing-passage lookup), returns an error markup string.
Methods
<Passage>.processText()
The fully processed passage text, ready for passage into the Wikifier.
Config.passages.onProcesscallback — if configured, the raw text is passed through the user-supplied function first.nobrprocessing — ifConfig.passages.nobristrueor the passage has thenobrtag, leading/trailing newlines are stripped and internal newline sequences are collapsed to single spaces.- Image passage transclusion — passages tagged
Twine.imagehave their text wrapped in[img[…]]markup automatically.
Usage examples
Reading a passage's properties
Reading a passage's properties
Filtering passages by tag
Filtering passages by tag
Guarding against missing passages
Guarding against missing passages
Story.get() never returns null — it returns an empty Passage whose text is an error message. Use Story.has() to guard when the passage may not exist.Using processText() with Config.passages.onProcess
Using processText() with Config.passages.onProcess
When
Config.passages.onProcess is set, processText() passes an abbreviated { name, tags, text } object to your callback. The callback’s return value replaces the text before nobr processing occurs.