remons-render-markdown 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,11 @@ interface MermaidRendererProps {
44
44
  * 是否为打印模式
45
45
  */
46
46
  isPrintPreview?: boolean;
47
+ /**
48
+ * 自定义配置函数,对渲染前 text 进行修改
49
+ * @returns
50
+ */
51
+ chartConfig?: (text: string) => string;
47
52
  }
48
53
  interface IProps {
49
54
  showDriverGuide?: boolean;
@@ -51,6 +56,15 @@ interface IProps {
51
56
  * 是否为打印模式
52
57
  */
53
58
  isPrintPreview?: boolean;
59
+ /**
60
+ * 自定义配置函数,对渲染前 text 进行修改
61
+ * @returns
62
+ */
63
+ chartConfig?: (text: string) => string;
64
+ /**
65
+ * 默认折叠状态
66
+ */
67
+ defaultCollapsed?: boolean;
54
68
  }
55
69
  declare const MermaidRenderer: React.ForwardRefExoticComponent<MermaidRendererProps & React.RefAttributes<null>>;
56
70
  declare function renderMermaidWithControls(props: IProps): Promise<void>;
@@ -9,8 +9,13 @@ interface UseMermaidRenderParams {
9
9
  source: string;
10
10
  debounceMs?: number;
11
11
  isDark: boolean;
12
+ /**
13
+ * 自定义配置函数,对渲染前 text 进行修改
14
+ * @returns
15
+ */
16
+ chartConfig?: (text: string) => string;
12
17
  }
13
- export default function useMermaidRender({ source, debounceMs, isDark }: UseMermaidRenderParams): {
18
+ export default function useMermaidRender({ source, debounceMs, isDark, chartConfig }: UseMermaidRenderParams): {
14
19
  svg: string;
15
20
  error: string;
16
21
  loading: boolean;
@@ -41,6 +41,15 @@ interface Props {
41
41
  * 是否为打印模式
42
42
  */
43
43
  isPrintPreview?: boolean;
44
+ /**
45
+ * 自定义配置函数,对渲染前 text 进行修改
46
+ * @returns
47
+ */
48
+ chartConfig?: (text: string) => string;
49
+ /**
50
+ * 默认是否折叠代码
51
+ */
52
+ defaultCollapsed?: boolean;
44
53
  }
45
54
  export default function RenderMarkdown(props: Props): React.JSX.Element;
46
55
  export {};