@tanstack/highlight
Version:
Tiny class-based syntax highlighting for documentation.
25 lines (24 loc) • 935 B
TypeScript
import type { Highlighter, HighlightDecoration } from './core.js';
import { type HastElement, type HastText } from './markdown.js';
export type RehypeHighlightOptions = {
getDecorations?: (node: HastElement) => ReadonlyArray<HighlightDecoration> | undefined;
getTitle?: (node: HastElement) => string | undefined;
highlighter: Highlighter;
lineNumbers?: boolean;
};
type HastNode = HastElement | HastText | RawNode | UnknownNode;
type RawNode = {
type: 'raw';
value: string;
};
type UnknownNode = {
children?: Array<HastNode>;
properties?: Record<string, unknown>;
tagName?: string;
type?: string;
value?: unknown;
[key: string]: unknown;
};
export declare function rehypeHighlightCodeBlocks(options: RehypeHighlightOptions): (tree: UnknownNode) => void;
export declare function rehypePreCodeToHast(node: HastElement, options: RehypeHighlightOptions): HastElement | undefined;
export {};