stream-markdown-render
Version:
Vue3 Markdown rendering component without repaint
114 lines (105 loc) • 3.25 kB
TypeScript
import { ComponentOptionsMixin } from 'vue';
import { ComponentProvideOptions } from 'vue';
import { default as default_2 } from 'markdown-it';
import { DefineComponent } from 'vue';
import { ExtractPropTypes } from 'vue';
import { JSX } from 'vue/jsx-runtime';
import { PropType } from 'vue';
import { PublicProps } from 'vue';
declare type ContainerPluginOptions = {
validate?: (params: string, markup: string) => boolean;
render?: (type: string, content: string, attr: string, isClosed: boolean, options: any) => any;
};
declare const _default: DefineComponent<ExtractPropTypes< {
content: {
type: StringConstructor;
required: true;
};
theme: {
type: PropType<MarkdownRenderProps["theme"]>;
default: string;
};
options: {
type: ObjectConstructor;
default: () => {};
};
}>, () => JSX.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
content: {
type: StringConstructor;
required: true;
};
theme: {
type: PropType<MarkdownRenderProps["theme"]>;
default: string;
};
options: {
type: ObjectConstructor;
default: () => {};
};
}>> & Readonly<{}>, {
theme: "default" | "dark" | "light" | undefined;
options: Record<string, any>;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export default _default;
/**
* EChartsRender 组件的属性接口
*/
export declare interface EChartsRenderProps {
/** ECharts 配置内容 */
content: string;
/** ECharts 配置选项 */
options?: {
/** 主题 */
theme?: 'default' | 'dark' | object;
/** 渲染器类型 */
renderer?: 'canvas' | 'svg';
/** 设备像素比 */
devicePixelRatio?: number;
/** 是否使用 UTC 时间 */
useUTC?: boolean;
};
/** 错误处理回调 */
onError?: (error: Error) => void;
/** 渲染完成回调 */
onRender?: (content: string) => void;
}
export declare interface MarkdownRenderProps {
content: string;
theme?: 'default' | 'dark' | 'light';
options?: {
mermaid?: MermaidRenderProps['options'];
echarts?: EChartsRenderProps['options'];
[key: string]: any;
};
}
export declare const md: default_2;
export declare function mdCustomPlugin(md: default_2, name: string, marker: string, options: ContainerPluginOptions): void;
export declare interface MermaidRenderProps {
/** Mermaid 图表内容 */
content: string;
/** Mermaid 配置选项 */
options?: {
/** 主题 */
theme?: 'default' | 'forest' | 'dark' | 'neutral';
/** 流程图方向 */
flowchart?: {
/** 曲线类型 */
curve?: 'basis' | 'linear' | 'cardinal';
};
/** 时序图配置 */
sequence?: {
/** 是否显示编号 */
showSequenceNumbers?: boolean;
};
/** 甘特图配置 */
gantt?: {
/** 左边距 */
leftPadding?: number;
};
};
/** 错误处理回调 */
onError?: (error: Error) => void;
/** 渲染完成回调 */
onRender?: (content: string) => void;
}
export { }