/** * @file Plugin registry helpers and the reference plugins. * * A plugin is data, validated and frozen at definition time; the * parser and vnode emitter bake plugin arrays into dispatch tables at * compile time (the normative contract lives in docs/PLUGINS.md). */ export type MdPlugin = { /** * unique kebab-case identifier */ name: string; /** * fenced-code claims by info-string first word */ fences?: string[]; /** * block rule descriptors ({ chars, start, continue, close }) */ blocks?: any[]; /** * inline rule descriptors ({ char, scan }) */ inlines?: any[]; /** * the AST type this plugin emits/renders */ node?: string; /** * pure vnode renderer */ render?: (node: any, h: any, ctx: any) => any; /** * pure HTML-string * renderer, for `toHtml`. Independent of `render`: a plugin may serve * one emitter, the other, or both (docs/PLUGINS.md §5.1) */ toHtml?: (node: any, ctx: any) => string; /** * browser-only upgrade */ hydrate?: (el: any, node: any, ctx: any) => any; }; /** * @typedef {object} MdPlugin * @property {string} name unique kebab-case identifier * @property {string[]} [fences] fenced-code claims by info-string first word * @property {any[]} [blocks] block rule descriptors ({ chars, start, continue, close }) * @property {any[]} [inlines] inline rule descriptors ({ char, scan }) * @property {string} [node] the AST type this plugin emits/renders * @property {(node: any, h: any, ctx: any) => any} [render] pure vnode renderer * @property {(node: any, ctx: any) => string} [toHtml] pure HTML-string * renderer, for `toHtml`. Independent of `render`: a plugin may serve * one emitter, the other, or both (docs/PLUGINS.md §5.1) * @property {(el: any, node: any, ctx: any) => any} [hydrate] browser-only upgrade */ /** * Validate and freeze a plugin spec (docs/PLUGINS.md §1). * @param {MdPlugin} spec * @returns {MdPlugin} */ export declare function definePlugin(spec: MdPlugin): MdPlugin; export { highlightPlugin, tokenizeCode, GRAMMAR_NAMES } from './highlight.js'; export { mermaidPlugin } from './mermaid.js';