/** * @typedef {{ code: string, grammar: import("prism-esm").Grammar, language: string } & { tokens: Array}} Env * @typedef {import("prism-esm").HookCallback} HookCallback */ /** * Custom hooks to run with our custom tokenizer. * @typedef {Object} Hooks * @property {Hook[]} [beforeTokenize] * @property {Hook[]} [afterTokenize] */ /** * Custom hooks to run with our custom tokenizer. * @typedef {(env: Env) => void} Hook */ export function createPrismInstance(): PrismJS; /** * @see https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/prism.js#L660 * A forked function from PrismJS to make wrap the tokenizer with custom functionality. * @param {string} text - The code to highlight * @param {import("prism-esm").Grammar} grammar - The grammar to use * @param {string} language - The language to detect * @param {typeof PrismSingleton["instance"]} highlighter * @param {Hooks} hooks */ export function PrismHighlight(text: string, grammar: import("prism-esm").Grammar, language: string, highlighter: (typeof PrismSingleton)["instance"], hooks?: Hooks): string; /** * @see https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/prism.js#L660 * A forked function from PrismJS to make wrap the tokenizer with custom functionality. * @param {string} text - The code to highlight * @param {import("prism-esm").Grammar} grammar - The grammar to use * @param {string} language - The language to detect * @param {typeof PrismSingleton["instance"]} highlighter * @param {Hooks} hooks */ export function PrismEnv(text: string, grammar: import("prism-esm").Grammar, language: string, highlighter: (typeof PrismSingleton)["instance"], hooks?: Hooks): Env; export type Env = { code: string; grammar: import("prism-esm").Grammar; language: string; } & { tokens: Array; }; export type HookCallback = import("prism-esm").HookCallback; /** * Custom hooks to run with our custom tokenizer. */ export type Hooks = { beforeTokenize?: Hook[] | undefined; afterTokenize?: Hook[] | undefined; }; /** * Custom hooks to run with our custom tokenizer. */ export type Hook = (env: Env) => void; import { Prism as PrismJS } from "prism-esm"; declare class PrismSingleton { static get instance(): PrismJS; } import { Token } from "prism-esm"; export {};