/** * Shared fenced-code-block renderer for the chat markdown path. * * `splitCodeFences` slices a markdown string into plain-text and fenced-code * segments so `ChatMessage` / `StreamingText` can keep their existing inline * tokenizers for the text runs and render `` for the code runs. * It tolerates an UNTERMINATED trailing fence — the streaming case, where the * closing ``` has not arrived yet — so a prompt renders as a code block as it * streams in. * * `CodeBlock` renders the code in a scrollable monospace surface with a Copy * affordance (clipboard + a brief "Copied" confirmation, graceful no-op when * the clipboard API is unavailable). No `dangerouslySetInnerHTML`. */ import { type HTMLAttributes } from 'react'; export type MarkdownSegment = { type: 'text'; value: string; } | { type: 'code'; lang?: string; value: string; }; /** * Split markdown into text + fenced-code segments. Matches an opening * ` ```lang\n `, lazy content, then either a closing ` \n``` ` on its own line * or end-of-input (the unterminated streaming case). */ export declare function splitCodeFences(input: string): MarkdownSegment[]; export interface CodeBlockProps extends Omit, 'children'> { /** Raw code text. */ code: string; /** Optional info string after the opening fence (e.g. `ts`, `bash`). */ language?: string; /** Render the Copy affordance. Default `true`. */ showCopy?: boolean; /** * The copy button's accessible name, translated. Default "Copy code". * Pass one per block when a page shows several, so each says what it * copies. */ copyLabel?: string; } export declare const CodeBlock: import("react").ForwardRefExoticComponent>; //# sourceMappingURL=code-block.d.ts.map