import { type VNode } from 'vue'; import type { Options, Renderer, Token } from '../markdown-it'; export interface TokenToVNodeOptions { /** * 对应 markdown-it 的 highlight 选项 * 允许 null | undefined,且参数签名包含 attrs */ highlight?: ((str: string, lang: string, attrs?: any) => string) | null; html?: boolean; /** * 与产生 tokens 的 MarkdownIt 实例的 `options` 一致,供 `renderer.rules` 第三参使用 * (markdown-it 的 rule 签名为 (tokens, idx, options, env, self),并非 Renderer 上的字段) */ mditOptions?: Options; renderer?: Renderer; /** * HTML 净化函数,用于处理 innerHTML 的内容 */ sanitize?: (html: string) => string; } type TokenAttrs = [string, string][]; /** * 公共入口函数,重置 key 计数器后调用内部函数 */ export declare const tokensToVNodes: (tokens: Token[], options?: TokenToVNodeOptions) => VNode[]; /** * 将 markdown-it 的 attrs 数组转换为 Vue h 函数需要的 props 对象 * - 支持同一属性多次出现:`class` 以空格拼接,`style` 以分号拼接(与常见 HTML 合并语义一致) * - 增加 key 参数,用于优化 Vue Diff 性能 */ export declare const attrsToStyleAndProps: (attrs: null | TokenAttrs, extraClass?: string, key?: number | string) => Record; export declare const renderFence: (token: Token, options: TokenToVNodeOptions, key: string) => VNode; export declare const renderImage: (token: Token, key: string) => VNode; export {};