/** * Lightweight terminal syntax highlighter for file-diff cards / pager. * * Goal: work for **any** common source language without shiki/tree-sitter. * Strategy: * - Map hundreds of extensions → language families * - Per-family keyword sets + comment/string rules * - Unknown extensions still get a **generic** highlighter (strings, comments, * numbers, punctuation) so every file type gets useful coloring */ export type LangFamily = "clike" | "js" | "css" | "json" | "html" | "md" | "sh" | "py" | "ruby" | "php" | "sql" | "lua" | "perl" | "r" | "haskell" | "lisp" | "erlang" | "fortran" | "yaml" | "toml" | "ini" | "diff" | "generic"; /** @deprecated alias kept for call sites */ export type LangId = LangFamily; export type SyntaxKind = "plain" | "keyword" | "string" | "comment" | "number" | "function" | "type" | "operator" | "punctuation" | "property" | "regex"; export interface SyntaxSpan { readonly kind: SyntaxKind; readonly text: string; } export interface HighlightCarry { inBlockComment: boolean; /** For languages with nested or multi-line strings (python triple-quote). */ inTripleString: boolean; tripleQuote?: string | undefined; } export declare function emptyCarry(): HighlightCarry; export declare function languageFromPath(path: string): LangFamily; /** @deprecated use languageFromPath */ export declare function languageFromPathLegacy(path: string): LangId; /** * Highlight one line for any path/language. Unknown types use generic rules. */ export declare function highlightLine(line: string, langOrPath: LangFamily | string, carry?: HighlightCarry): SyntaxSpan[]; export declare function highlightLineForPath(line: string, path: string, carry?: HighlightCarry): SyntaxSpan[]; export declare function highlightLines(lines: readonly string[], langOrPath: LangFamily | string): SyntaxSpan[][]; export declare function clipSpans(spans: readonly SyntaxSpan[], maxChars: number): SyntaxSpan[]; /** List of extensions we explicitly map (for tests / docs). */ export declare function supportedExtensions(): string[];