UNPKG

@tanstack/highlight

Version:

Tiny class-based syntax highlighting for documentation.

27 lines (26 loc) • 1.4 kB
import type { TokenRange } from '../core.js'; import type { Pattern } from './patterns.js'; export declare const cComments: RegExp; export declare const quotedStrings: RegExp; export declare const doubleStrings: RegExp; export type SimpleLanguageOptions<Name extends string = string> = { name: Name; aliases?: ReadonlyArray<string>; comments: RegExp; strings: RegExp; keywords?: string; literals?: string; types?: string; insensitive?: boolean; wordCharacters?: string; nestedComments?: ReadonlyArray<readonly [string, string]>; beforeWords?: ReadonlyArray<Pattern>; rules?: ReadonlyArray<Pattern>; numberSuffix?: string; numbers?: RegExp | false; }; export declare function simpleLanguage<const Name extends string>(options: SimpleLanguageOptions<Name>, wordPatterns?: WordPatterns, owned?: boolean): import("../core.js").LanguageDefinition<Name>; export declare function createSimpleTokenizer(options: SimpleLanguageOptions, wordPatterns?: WordPatterns, owned?: boolean): (code: string) => TokenRange[]; export declare function wordCategories(options: SimpleLanguageOptions): readonly [readonly ["keyword", string | undefined], readonly ["literal", string | undefined], readonly ["type", string | undefined]]; type WordPatterns = (options: SimpleLanguageOptions, flags: string, wordCharacters: string) => ReadonlyArray<Pattern>; export {};