UNPKG

@humanspeak/svelte-markdown

Version:

Markdown and HTML renderer for Svelte 5 — built for rendering streaming AI agent output from Claude Code, ChatGPT, and agentic workflows. XSS-safe defaults, streaming-aware sanitization, token caching, TypeScript types, and Svelte 5 runes.

27 lines (26 loc) 993 B
import type { SvelteMarkdownOptions } from '../types.js'; import type { Token } from './markdown-parser.js'; export interface StreamBenchmarkResult { totalChars: number; chunkCount: number; totalParseMs: number; peakParseMs: number; p95ParseMs: number; finalTokens: Token[]; parseDurationsMs: number[]; } /** * Benchmarks incremental parsing performance by simulating streaming chunk appends. * * @param chunks - Array of string chunks to append sequentially * @param options - SvelteMarkdown parser options forwarded to IncrementalParser * @returns Benchmark results including per-chunk timing, peak, and p95 parse durations * * @example * ```ts * const chunks = ['# Hello ', 'world, ', 'this is a test.'] * const result = benchmarkAppendStream(chunks, { gfm: true }) * console.log(result.p95ParseMs, result.peakParseMs) * ``` */ export declare const benchmarkAppendStream: (chunks: string[], options: SvelteMarkdownOptions) => StreamBenchmarkResult;