/**
* markdown-it plugin: renders `plantuml` / `puml` / `uml` fences as inline SVG.
*
* markdown-it renders synchronously while excaliplant (ELK) is asynchronous.
* The plugin bridges the two with a content-addressed cache:
*
* - cache hit → the rule returns the SVG immediately;
* - cache miss → the rule returns a placeholder
* `
`,
* starts rendering in the background and calls `onRendered(hash)` when done,
* so the host can render again;
* - `await prerender(md, text)` renders every block up front, so the following
* synchronous `md.render(text)` is complete.
*
* There is no dependency on markdown-it; only `md.renderer.rules.fence` and
* `md.parse` are used.
* @module markdown/markdown_it
*/
import { createCache } from "./cache.mjs";
export type MarkdownItOptions = import("./render.mjs").BlockOptions & {
onRendered?: (hash: string) => void;
shareFont?: boolean;
budget?: Partial;
};
export type PluginState = {
base: import("./render.mjs").BlockOptions;
cache: import("./cache.mjs").Cache;
onRendered: ((hash: string) => void) | undefined;
shareFont: boolean;
budget: {
maxBlocks: number;
maxTotalSourceBytes: number;
};
};
/**
* markdown-it plugin.
* @param {any} md markdown-it instance.
* @param {MarkdownItOptions} [opts] Render options (`theme`, `clean`, `seed`, `width`, `limits`, …),
* `cache` (shared `createCache()` result), `onRendered(hash)`, `shareFont` (default true: only the
* first diagram of a render embeds Excalifont) and `budget`.
* @returns {void}
* @public
*/
declare function excaliplantPlugin(md: any, opts?: MarkdownItOptions): void;
export default excaliplantPlugin;
declare namespace excaliplantPlugin {
export { prerender };
}
/**
* Render every PlantUML block of `markdown` into the plugin's cache so that
* a following synchronous `md.render(markdown)` is complete.
* @param {any} md markdown-it instance with {@link excaliplantPlugin} installed.
* @param {string} markdown
* @param {object} [env] Environment passed to `md.parse` (not retained).
* @returns {Promise} One result per block, in document order.
* @public
*/
export declare function prerender(md: any, markdown: string, env?: object): Promise;
export { createCache };