import type { SymbolTheme } from "../symbols"; import type { Component } from "../tui"; import { type ViewportAnchorSpan } from "../utils"; /** Test-only clock seam for streaming throttle tests. */ export declare function __setMarkdownNowForTest(now: (() => number) | undefined): void; /** Test/diagnostic seam: number of synchronous highlight invocations since the last reset. */ export declare function getMarkdownHighlightCallCount(): number; export declare function resetMarkdownHighlightCallCount(): void; /** Test-only performance counters for advisory baseline tests. */ export declare const __markdownPerfCounters: { lexerInvocations: number; lexedBytes: number; reset(): void; }; /** Drop all L2 cache entries. Call on theme change to prevent stale styled output. */ export declare function clearRenderCache(): void; export declare function getRenderCacheRetainedBytes(): number; /** * Default text styling for markdown content. * Applied to all text unless overridden by markdown formatting. */ export interface DefaultTextStyle { /** Foreground color function */ color?: (text: string) => string; /** Background color function */ bgColor?: (text: string) => string; /** Bold text */ bold?: boolean; /** Italic text */ italic?: boolean; /** Strikethrough text */ strikethrough?: boolean; /** Underline text */ underline?: boolean; } /** * Theme functions for markdown elements. * Each function takes text and returns styled text with ANSI codes. */ export interface MarkdownTheme { heading: (text: string) => string; link: (text: string) => string; linkUrl: (text: string) => string; code: (text: string) => string; codeBlock: (text: string) => string; codeBlockBorder: (text: string) => string; quote: (text: string) => string; quoteBorder: (text: string) => string; hr: (text: string) => string; listBullet: (text: string) => string; bold: (text: string) => string; italic: (text: string) => string; strikethrough: (text: string) => string; underline: (text: string) => string; highlightCode?: (code: string, lang?: string) => string[]; /** * Resolve a mermaid ASCII rendering by fenced block source text. * Return null to fall back to fenced code rendering. */ resolveMermaidAscii?: (source: string) => string | null; symbols: SymbolTheme; } export declare class Markdown implements Component { #private; constructor(text: string, paddingX: number, paddingY: number, theme: MarkdownTheme, defaultTextStyle?: DefaultTextStyle, codeBlockIndent?: number); setOnStaleThrottle(callback: (() => void) | undefined): void; setText(text: string, options?: { streaming?: boolean; }): void; setStreaming(streaming: boolean): void; dispose(): void; invalidate(): void; render(width: number): string[]; renderWithViewportAnchorSource(width: number, source: { id: string; }): { lines: string[]; anchors: Array<({ id: string; } & ViewportAnchorSpan) | null>; }; } /** * Render inline markdown (bold, italic, code, links, strikethrough) to a styled string. * Unlike the full Markdown component, this produces a single line with no block-level elements. */ export declare function renderInlineMarkdown(text: string, mdTheme: MarkdownTheme, baseColor?: (t: string) => string): string;