Split player-written text into styleable pieces — text, @mention, #tag.
Re-exported so every app renders a mention the same way, and so there is one place to audit.
Lives in shared/, because the server needs the same definition to decide who a mention
notifies. mentionedHandles is that half, re-exported here when a caller needs it.
It returns data, not markup, which is the point: each token goes to the DOM through
Svelte's {text} and escapes, so no sanitizer is involved because nothing is ever parsed as
HTML. Building an HTML string for {@html} is the alternative, and it is how a message
becomes script.
tokenizeRichText(input:string):RichTextToken[]
Tokenize a message.
Never throws and never drops input: concatenating every token's source is the original
string. A parser that can lose characters is a parser that can lose the end of somebody's
sentence.
Split player-written text into styleable pieces — text,
@mention,#tag.Re-exported so every app renders a mention the same way, and so there is one place to audit. Lives in
shared/, because the server needs the same definition to decide who a mention notifies.mentionedHandlesis that half, re-exported here when a caller needs it.It returns data, not markup, which is the point: each token goes to the DOM through Svelte's
{text}and escapes, so no sanitizer is involved because nothing is ever parsed as HTML. Building an HTML string for{@html}is the alternative, and it is how a message becomes script.