import { Marked } from 'marked'; import { StreamBlock } from './types'; export interface BlockStreamOptions { marked: Marked; /** * Applied to every markup block's HTML before it is cached, so cached HTML * is always safe to hand to `v-html`. Identity when omitted. Swap by * calling `reset()` and re-updating — the stream never re-runs it on * blocks it considers stable. */ sanitize?: (html: string) => string; } export interface BlockStream { /** Feeds the full accumulated content and returns the renderable blocks. */ update: (content: string) => StreamBlock[]; /** Drops all cached state; the next update recomputes every block. */ reset: () => void; } /** * Incremental block renderer for a growing markdown document. * * Comparison-driven rather than assumption-driven: every update re-lexes the * full content (cheap, token-only) and keeps the longest prefix of blocks * whose `raw` is unchanged — parse and sanitize run only on what actually * changed. Markdown constructs that rewrite earlier text (setext headings, * list continuation) break the prefix at the rewrite point and re-render * exactly the affected blocks. */ export declare function createBlockStream(options: BlockStreamOptions): BlockStream;