ds-markdown
Version:
> 🚀 React Markdown 打字动画组件,提供现代聊天界面效果
75 lines • 2.58 kB
TypeScript
import { Pluggable } from 'unified';
import Mermaid from './mermaid.type.js';
import { KatexOptions } from 'katex';
import type { MarkdownBaseRef, MarkdownTyperBaseProps } from 'react-markdown-typer/es/defined';
/**
* 回答类型,思考和回答
*/
export type AnswerType = 'answer' | 'thinking';
export type Theme = 'light' | 'dark';
export interface IMarkdownThemeProps {
/** 主题 */
theme?: Theme;
/** 数学公式配置 */
math?: IMarkdownMath;
/** 代码块配置 */
codeBlock?: IMarkdownCode;
/** 插件配置 */
plugins?: IMarkdownPlugin[];
/** 回答类型 */
answerType?: 'thinking' | 'answer';
}
export interface IMarkdownThemeStateProps extends IMarkdownThemeProps {
theme: Theme;
answerType: AnswerType;
}
export interface IMarkdownCode {
/** 是否显示头部操作按钮
* 如果为true,则显示头部操作按钮
* 如果为React.ReactNode,则显示自定义头部操作按钮
*/
headerActions?: boolean | React.ReactNode;
}
export interface MarkdownBaseProps extends MarkdownTyperBaseProps {
}
export interface MarkdownProps extends MarkdownTyperBaseProps, IMarkdownThemeProps {
children: string | undefined;
}
/** MarkdownCMD 组件不需要 children */
export interface MarkdownCMDProps extends MarkdownTyperBaseProps, IMarkdownThemeProps {
children?: undefined;
isInnerRender?: boolean;
}
export interface IMarkdownPlugin {
remarkPlugin?: Pluggable;
rehypePlugin?: Pluggable;
type: 'buildIn' | 'custom';
id?: any;
components?: Record<string, React.ComponentType<unknown>>;
}
export interface IMarkdownMath {
/** 是括号还是$作为分隔符, 默认是$ */
splitSymbol: 'bracket' | 'dollar';
/** 数学公式替换函数 */
replaceMathBracket?: (value: string) => string;
}
/** Markdown 组件的ref 类型 */
export type MarkdownRef = MarkdownBaseRef;
/** MarkdownCMD 组件的 ref 类型 */
export interface MarkdownCMDRef extends MarkdownBaseRef {
push: (content: string, answerType?: AnswerType) => void;
clear: () => void;
triggerWholeEnd: () => void;
}
export interface IMarkdownMermaidConfig extends Mermaid.MermaidConfig {
/** 是否显示头部操作按钮
* 如果为true,则显示头部操作按钮
* 如果为React.ReactNode,则显示自定义头部操作按钮
*/
headerActions?: boolean | React.ReactNode | ((data: {
graphSvg: SVGElement;
}) => React.ReactNode);
}
export interface IMarkdownKatexConfig extends KatexOptions {
}
//# sourceMappingURL=index.d.ts.map