@tanstack/highlight
Version:
Tiny class-based syntax highlighting for documentation.
41 lines (40 loc) • 1.46 kB
TypeScript
export declare const themeTokenClasses: readonly ["token", "attr", "code-inline", "command", "comment", "deleted", "function", "heading", "inserted", "keyword", "link", "literal", "meta", "number", "operator", "property", "selector", "string", "tag", "type", "variable"];
export type HighlightThemeToken = (typeof themeTokenClasses)[number];
export type HighlightTheme = {
background: string;
foreground: string;
name: string;
tokens: Record<HighlightThemeToken, string>;
type: 'dark' | 'light';
};
export type ThemeBaseCssOptions = {
codeBlockSelector?: string;
lineNumbersSelector?: string;
};
type ThemeCssOptions = ThemeBaseCssOptions & {
darkSelector?: string;
includeBaseStyles?: boolean;
lightSelector?: string;
};
type ThemeListOptions = {
dark?: never;
light?: never;
themes: ReadonlyArray<{
selector: string;
theme: HighlightTheme;
}>;
};
type ThemePairOptions = {
dark?: HighlightTheme;
light: HighlightTheme;
themes?: never;
} | {
dark: HighlightTheme;
light?: HighlightTheme;
themes?: never;
};
export type CreateThemeCssOptions = ThemeCssOptions & (ThemeListOptions | ThemePairOptions);
export declare function createThemeCss(options: CreateThemeCssOptions): string;
export declare function createThemeRule(selector: string, theme: HighlightTheme): string;
export declare function createThemeBaseCss(options?: ThemeBaseCssOptions): string;
export {};