/** * @public */ export type TextFormatterFn = (value: string) => string; /** * @public */ export type TextFormatter = TextFormatterFn | Lowercase; /** * @public */ export declare namespace TextFormatters { /** * This function does not apply any formatting to the text. * * @public */ const DEFAULT: (value: string) => string; /** * Formats a WhatsApp-style rich text into HTML. * * This formatter intentionally targets the **practical WhatsApp message syntax** (as commonly typed), * not full Markdown. It focuses on predictable rendering for chat-/note-like UIs. * * ## Supported syntax * * ### Inline formatting * - Bold: * - `*text*` → `text` * - Italic: * - `_text_` → `text` * - Underline: * - `++text++` → `text` * - Double-underline: * - `+++text+++` → `text` * - Strikethrough: * - `~text~` → `text` * - Colored text: * - `{red}text{/red}` → `text` * - Supports any valid CSS color value (named colors, hex, rgb, css-vars etc.) * * ### Code * - Inline code: * - `` `code` `` → `code` * - Code block (fenced): * - ```multi line``` → `
...
` * - Code content is HTML-escaped and protected first, so formatting markers inside code are not interpreted. * * ### Block-level syntax (line-based) * - Horizontal rule: * - `---` or `***` or `___` (alone on a line) → `
` * - Bulleted list items: * - `- item` or `* item` at line start * - Consecutive bullet lines are grouped into a single `