/** * Pure, DOM-free WhatsApp markup helpers. * * WhatsApp messages are plain text with lightweight inline markers — *not* HTML. * The string the user types (and that you send to the WhatsApp API) IS the * source of truth. These helpers only: * * - `toPreviewHTML(text)` — render a faithful preview of how WhatsApp displays * the markers (bold/italic/strikethrough/monospace, quotes, lists, breaks). * - `toggleMarker(value, start, end, marker)` — wrap/unwrap a textarea selection * with an inline marker (powers the toolbar + keyboard shortcuts). * * Supported syntax (per WhatsApp's "How to format your messages"): * - `*bold*` → * - `_italic_` → * - `~strikethrough~` → * - `` `inline mono` `` → * - ```` ```block``` ```` →

 * - `> quote`           → 
* - `- ` / `* ` bullet →
  • * - `1. ` numbered →
    1. */ /** Inline marker identifiers exposed to the toolbar. */ export type WhatsappMarker = 'bold' | 'italic' | 'strikethrough' | 'monospace'; /** Line-prefix block identifiers exposed to the toolbar. */ export type WhatsappBlock = 'blockquote' | 'bullet' | 'ordered'; /** The literal characters each inline marker wraps the selection with. */ export declare const WHATSAPP_MARKERS: Record; /** Result of a {@link toggleMarker} operation. */ export interface WrapResult { /** The new full text value. */ value: string; /** New selection start, so the caller can restore the textarea selection. */ selectionStart: number; /** New selection end. */ selectionEnd: number; } /** * Render WhatsApp markup to preview HTML. Output is safe: all user text is * HTML-escaped before markers are interpreted. */ export declare function toPreviewHTML(text: string): string; /** * Toggle an inline marker around a textarea selection. If the selection (or the * characters immediately surrounding it) is already wrapped with `marker`, it is * unwrapped; otherwise the selection is wrapped. Returns the new value and the * selection range to restore. */ export declare function toggleMarker(value: string, start: number, end: number, marker: string): WrapResult; /** * Whether the current selection is already wrapped with `marker` — true when the * selection itself includes the markers (`*bold*` selected) or when they sit * immediately outside it (`*|bold|*`). Mirrors {@link toggleMarker}'s unwrap * cases so a toolbar can reflect the active state of a button. Pure. */ export declare function isMarkerActive(value: string, start: number, end: number, marker: string): boolean; /** * Toggle a line-prefix block (blockquote, bullet or numbered list) across every * line spanned by the selection. If all non-empty lines already carry the * prefix it is removed; otherwise it is added (numbered lists are renumbered * from 1). Returns the new value with the selection spanning the affected block. */ export declare function toggleLinePrefix(value: string, start: number, end: number, kind: WhatsappBlock): WrapResult; /** * Strip every WhatsApp marker from `text`, returning the plain underlying * content: removes inline bold/italic/strikethrough/monospace (including nested * combinations), fenced code blocks, and line-prefix blocks (quote/bullet/ * numbered). Pure and idempotent. */ export declare function stripFormatting(text: string): string;