rich-text-parser
RichTextParser merges MarkdownParser, EmojiParser, ImageParser, and ContentParser segment logic into unified RichTextToken[] output.
Types
RichTextTokenType—text,hashtag,mention,url,markdown,emoji,image.RichTextToken— Span metadata plus optionalhref, emoji fields, image fields, mentionuserId/filterType, URLbehavior.RichTextConfig— Toggle each feature; optionalimageConfig(dimensions,allowedDomains).
Class
new RichTextParser(config?)— Defaults enable all parsers unless explicitlyfalse.parse(text)— Returns ordered tokens withstart/end/rawText.- Module singleton:
richTextParser.
Use when rendering rich submission bodies that need one token stream for highlights and pills.
Sources: src/lib/utils/parsers/rich-text-parser.ts