ExtractTags
Function: extractTags()
extractTags(message, options?): ExtractedTag[]
Defined in: packages/tagscript/src/lib/Interpreter/extract.ts:91
Finds every tag in a template without running any of them.
This is what the interpreter itself sees, so a tool built on it agrees with a render by construction. Use it to highlight a template, to validate one before saving it, or to load one into an editor.
Nothing here says whether a tag will be handled. That depends on which parsers are registered, so an unknown tag looks exactly like a known one.
Parameters
message
string
The template to read.
options?
ExtractOptions = {}
The same settings a render would use, so the result matches what running it would produce.
Returns
Every tag, in document order.
Example
const [tag] = extractTags('Hi {upper:there}');
tag.tag.declaration; // 'upper'
message.slice(tag.spans.payload.start, tag.spans.payload.end); // 'there'