/** * @file Syntax highlighting for fenced code blocks (PLUGINS.md ยง6.2). * * Built-in mode is a zero-dependency single-pass tokenizer driven by * compact grammar tables โ€” a keyword set, comment/string delimiters * and punctuation classes โ€” compiled to closures once at module load. * No regex runs in the token loop. Adapter mode puts shiki/prism/ * highlight.js behind the same `{ kind, value }` token contract. * * Token kinds: kw str num com pun id op lit โ€” rendered as * `span.tok-{kind}` (plain `id` runs render as bare text). */ export type Token = { kind: 'kw' | 'str' | 'num' | 'com' | 'pun' | 'id' | 'op' | 'lit'; value: string; }; export type MdGrammar = { keywords?: string[]; literals?: string[]; /** * comment-to-end-of-line prefixes */ lineComments?: string[]; /** * open/close pair */ blockComment?: [string, string]; /** * string delimiter characters */ strings?: string; /** * recognize number literals */ numbers?: boolean; /** * extra identifier characters (e.g. `-` for CSS) */ extraId?: string; }; /** The canonical names of the shipped grammars (aliases resolve too). */ export declare const GRAMMAR_NAMES: readonly string[]; /** * Tokenize `code` with the built-in grammar for `lang`. Returns null * when no grammar covers the language. * @param {string} code * @param {string|null} lang * @returns {Token[] | null} */ export declare function tokenizeCode(code: string, lang: string | null): Token[] | null; /** * The syntax-highlighting plugin: takes over rendering of `code` * nodes. `adapter(code, lang)` may return tokens (shiki/prism/hljs * behind the shared contract) or null to fall back to the built-in * grammars, then to plain text. * * @param {{ grammars?: Record, * adapter?: (code: string, lang: string|null) => (Token[] | null) }} [config] * @returns {import('./index.js').MdPlugin} */ export declare function highlightPlugin(config?: { grammars?: Record; adapter?: (code: string, lang: string | null) => (Token[] | null); }): import('./index.js').MdPlugin;