/** Inline formatting range — tracks formatting on plain text. */ export interface FormatRange { start: number; end: number; type: "bold" | "italic" | "code" | "strikethrough" | "link"; url?: string; } /** Plain text + formatting ranges — no markdown syntax visible. */ export interface InlineModel { text: string; formats: FormatRange[]; } /** Parse inline markdown into plain text + formatting ranges. */ export declare function parseInlineModel(markdown: string): InlineModel; /** Serialize InlineModel back to markdown. */ export declare function modelToMarkdown(model: InlineModel): string; /** * Adjust format ranges after text input. * Call this when textarea content changes. */ export declare function adjustFormats(formats: FormatRange[], changePos: number, delta: number): FormatRange[]; /** * Reconcile format ranges with a textarea edit. * * `adjustFormats` describes one signed delta, which cannot express an edit that * deletes and inserts at once — paste over a selection, select-all-then-type, * drag-and-drop, IME/autocorrect replacement. Recovering a single delta from * such an edit leaves the ranges on unrelated characters. * * The `input` event carries no description of what changed, so derive it: the * inserted text ends at the cursor, which anchors the tail; the head is the * common prefix of what precedes it. That yields a delete and an insert, both * of which `adjustFormats` already handles. */ export declare function applyTextEdit(formats: FormatRange[], prevText: string, nextText: string, cursor: number): FormatRange[]; /** Check which format types are active at a cursor position. */ export declare function activeFormatsAt(formats: FormatRange[], start: number, end: number): Set; /** Toggle a format on a selection range. Returns updated formats array. */ export declare function toggleFormat(formats: FormatRange[], selStart: number, selEnd: number, type: "bold" | "italic" | "code" | "strikethrough"): FormatRange[]; /** Walk text nodes in a container, returning nodes with cumulative offsets. */ export declare function walkTextNodes(container: Node): { node: Text; start: number; end: number; }[]; /** Map a DOM range (or StaticRange) to plain text offsets using a text node map. */ export declare function rangeToOffsets(range: { startContainer: Node; startOffset: number; endContainer: Node; endOffset: number; }, textNodes: { node: Text; start: number; end: number; }[]): { start: number; end: number; } | null; /** Apply CSS Custom Highlights from FormatRange[] onto DOM text nodes. */ export declare function applyHighlights(formats: FormatRange[], textNodes: { node: Text; start: number; end: number; }[]): void; /** Clear all markdown format highlights. */ export declare function clearHighlights(): void; //# sourceMappingURL=inline-edit.d.ts.map