import React from 'react'; import type { Plugin, Processor } from 'unified'; import type { FormulaConfig } from '../Config/formulaConfig'; import type { MarkdownRemarkPlugin, MarkdownToHtmlConfig } from '../MarkdownEditor/editor/utils/markdownToHtml'; import type { MarkdownEditorProps } from '../MarkdownEditor/types'; import { createHastProcessor } from './processor'; import type { MarkdownRendererEleProps, RendererBlockProps } from './types'; /** hast → React 组件映射,与 MarkdownEditor Readonly 的 data-be / prefixCls 对齐 */ declare const buildEditorAlignedComponents: (prefixCls: string, userComponents: Record>, streaming?: boolean, linkConfig?: { openInNewTab?: boolean | undefined; onClick?: ((url?: string) => boolean | void) | undefined; } | undefined, fncProps?: MarkdownEditorProps['fncProps'], eleRender?: ((props: MarkdownRendererEleProps, defaultDom: React.ReactNode) => React.ReactNode) | undefined) => { p: (props: any) => React.ReactNode; h1: (props: any) => React.ReactNode; h2: (props: any) => React.ReactNode; h3: (props: any) => React.ReactNode; h4: (props: any) => React.ReactNode; h5: (props: any) => React.ReactNode; h6: (props: any) => React.ReactNode; blockquote: (props: any) => React.ReactNode; ul: (props: any) => React.ReactNode; ol: (props: any) => React.ReactNode; li: (props: any) => React.ReactNode; table: (props: any) => React.ReactNode; thead: (props: any) => React.ReactElement>; tbody: (props: any) => React.ReactElement>; tr: (props: any) => React.ReactElement>; th: (props: any) => React.ReactElement>; td: (props: any) => React.ReactElement>; input: (props: any) => React.ReactElement>; a: (props: any) => React.ReactNode; strong: (props: any) => React.ReactNode; em: (props: any) => React.ReactNode; del: (props: any) => React.ReactNode; code: (props: any) => React.ReactElement>; mark: (props: any) => React.ReactNode; kbd: (props: any) => React.ReactNode; sub: (props: any) => React.ReactNode; pre: (props: any) => React.ReactNode; img: (props: any) => React.ReactNode; video: (props: any) => React.ReactNode; audio: (props: any) => React.ReactNode; iframe: (props: any) => React.ReactNode; hr: (props: any) => React.ReactNode; sup: (props: any) => React.ReactNode; span: (props: any) => React.ReactElement>; section: (props: any) => React.ReactElement>; think: (props: any) => React.FunctionComponentElement; thinking: (props: any) => React.FunctionComponentElement; answer: (props: any) => React.ReactElement>; }; /** markdown 片段 → React 元素;解析失败时降级为原文
 兜底,避免内容静默丢失。 */
declare const renderMarkdownBlock: (blockContent: string, processor: Processor, components: Record) => React.ReactNode;
/** 按单空行拆块,保留围栏代码块、列表、blockquote、HTML 注释+表格、脚注定义、think 标签、GFM 表格的连续性 */
declare const splitMarkdownBlocks: (content: string) => string[];
export interface UseMarkdownToReactOptions {
    remarkPlugins?: MarkdownRemarkPlugin[];
    rehypePlugins?: Plugin[];
    htmlConfig?: MarkdownToHtmlConfig;
    formula?: FormulaConfig;
    components?: Record>;
    prefixCls?: string;
    linkConfig?: {
        openInNewTab?: boolean;
        onClick?: (url?: string) => boolean | void;
    };
    fncProps?: MarkdownEditorProps['fncProps'];
    streaming?: boolean;
    /** A completed stream shows all buffered blocks without static batching. */
    isFinished?: boolean;
    /** 是否对文本拆分 token 做逐词淡入(已含 streaming 判定,由上层解析后传入) */
    fadeTokens?: boolean;
    /**
     * 逐词淡入的用户配置开关。与 `fadeTokens` 不同:不随流式结束翻转,
     * 仅在宿主显式修改 `throttleOptions.fade` 时变化,用于驱动 processor
     * 重建使缓存块按新配置重解析(fade 切换不重解析会残留旧 token 树)。
     */
    fadeTokensConfig?: boolean;
    /** 原始流字符串,与 useStreaming 输出分离避免缓存误判 */
    contentRevisionSource?: string;
    /** 返回 undefined 回退默认渲染 */
    eleRender?: (props: MarkdownRendererEleProps, defaultDom: React.ReactNode) => React.ReactNode;
}
export { buildEditorAlignedComponents, createHastProcessor, renderMarkdownBlock, splitMarkdownBlocks, };
export type { MarkdownRendererEleProps };