/** * Fenced code block presentation for chat + pager markdown. * * Renders a bordered panel with a language label, real syntax colors, exact * source indentation, and column-accurate soft wrapping (no ellipsis, no * dropped characters, wide glyphs never straddle the right border). */ import { type HighlightCarry } from "./syntax-highlight.js"; /** Columns consumed by `│ ` + body + ` │`. */ export declare const CODE_BLOCK_CHROME = 4; export interface CodeFenceState { /** Opening run of backticks or tildes — only a matching run closes it. */ readonly marker: string; /** Language name or file path shown in the panel header. */ readonly label: string; /** Synthetic path handed to the highlighter to resolve the language. */ readonly langPath: string; readonly carry: HighlightCarry; /** Blank rows held back so trailing padding never reaches the footer. */ pendingBlanks: number; } /** Match an opening fence and capture its marker + info string. */ export declare function matchCodeFenceOpen(line: string): { marker: string; info: string; } | undefined; /** A fence closes on a bare run of the same character, at least as long. */ export declare function isCodeFenceClose(line: string, marker: string): boolean; export declare function openCodeFence(marker: string, info: string): CodeFenceState; /** Clamp the panel to the wrap budget so it never overflows the pane. */ export declare function codeBlockWidth(wrapWidth: number): number; /** Drop blank lines at the block edges so the panel hugs its code. */ export declare function trimCodeBlockBody(lines: readonly string[]): string[]; /** * Panel width that fits the widest code line, so a one-line snippet is not * stretched across the whole pane. Falls back to `available` when the code is * wider than the pane, which is when wrapping takes over. */ export declare function codeBlockFitWidth(lines: readonly string[], label: string, available: number): number; export declare function codeBlockTop(label: string, width: number): string; export declare function codeBlockBottom(width: number): string; /** Pad a painted body to the panel's inner width and add both borders. */ export declare function codeBlockRow(body: string, bodyWidth: number, width: number): string; /** * Render one source line as complete panel rows. Blank lines are buffered so a * block that ends with padding does not push empty rows against the footer. */ export declare function codeBlockRows(source: string, fence: CodeFenceState, width: number): string[];