import { TokenTypeRegistry, type LexedSyntax, type SyntaxLang } from './lexer.js'; export interface SyntaxStylerOptions { /** * Token-type id space used by the registered lexers. Defaults to the shared * `token_types_global`, which the built-in lexers intern into — inject a * separate registry only when every registered lexer interns into that same * registry. */ token_types?: TokenTypeRegistry; } /** * Registry and facade over the hand-written lexer engine (`lexer.ts`): registers * languages, lexes text to a flat token event stream, and renders that stream to * syntax-highlighted HTML. * * @example * ```ts * import {syntax_styler_global} from './syntax_styler_global.js'; * * const html = syntax_styler_global.stylize('const x = 1;', 'ts'); * ``` */ export declare class SyntaxStyler { /** * Registered languages, keyed by id and by each alias. */ langs: Map; /** * Token-type id space for this styler's languages. * See `SyntaxStylerOptions.token_types`. */ readonly token_types: TokenTypeRegistry; constructor(options?: SyntaxStylerOptions); /** * Registers a language (and its aliases). */ add_lang(lang: SyntaxLang): void; /** * Whether a language is registered under `id` (its primary id or an alias). */ has_lang(id: string): boolean; /** * Lexes `text` with the language registered as `lang`, returning the flat * token event stream. Throws when `lang` is not registered — see `has_lang`. */ lex(text: string, lang: string): LexedSyntax; /** * Generates syntax-highlighted HTML (spans with `.token_*` classes) from * `text`. Throws when `lang` is not registered — see `has_lang`. */ stylize(text: string, lang: string): string; } //# sourceMappingURL=syntax_styler.d.ts.map