export type RegexReplacer = (substring: string, ...args: any[]) => string; export interface SlimdownRenderHookInput { /** Escape text for safe HTML text-node output. */ escapeHtml: (value: string) => string; } export interface SlimdownCodeBlockInput extends SlimdownRenderHookInput { lang: string; code: string; } export interface SlimdownMathInput extends SlimdownRenderHookInput { math: string; } export interface SlimdownExtension { /** * Render a fenced code block. Return undefined to let the next extension or * the built-in renderer handle it. */ renderCodeBlock?: (input: SlimdownCodeBlockInput) => string | undefined; /** Render a block math expression captured from $$...$$. */ renderMathBlock?: (input: SlimdownMathInput) => string | undefined; /** Render an inline math expression captured from $...$. */ renderInlineMath?: (input: SlimdownMathInput) => string | undefined; } export declare const escapeHtml: (s: string) => string; /** Options for the {@link render} function. */ export interface RenderOptions { /** If true, remove the `
...
` wrapper around top-level paragraphs. Default: false. */ removeParagraphs?: boolean; /** If true, add `target="_blank"` to all links. Default: false. */ externalLinks?: boolean; /** If true, parse alpha ordered lists such as `a.`, `A)`, or `(b)`. Default: false. */ alphaLists?: boolean; /** If true, add a slugified `id` attribute to each heading. Default: false. */ headingIds?: boolean; /** Optional render hooks for code blocks and math placeholders. */ extensions?: SlimdownExtension[]; } /** * Render Markdown text into HTML. * * @param markdown Markdown text * @param optionsOrRemoveParagraphs Either a {@link RenderOptions} object, or a boolean to remove * the `` wrapper around paragraphs (legacy positional form). * @param externalLinks If true (default false), add `target="_blank"` to all links. * Only used when the second argument is a boolean (legacy form). */ export declare function render(markdown: string, options?: RenderOptions): string; export declare function render(markdown: string, removeParagraphs?: boolean, externalLinks?: boolean): string; /** * Add a new rule: The regex should be global and not use multiline mode. */ export declare const addRule: (regex: RegExp, replacement: RegexReplacer | string) => void;