@superlc/md-react 0.1.1 → 0.2.0

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.
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from 'react';
2
- import { ProcessorOptions } from '@superlc/md-core';
2
+ import { ProcessorOptions, MermaidTheme } from '@superlc/md-core';
3
3
 
4
4
  /**
5
5
  * 自定义组件映射表
@@ -8,6 +8,15 @@ import { ProcessorOptions } from '@superlc/md-core';
8
8
  export type MarkdownComponents = {
9
9
  [key: string]: ComponentType<Record<string, unknown>> | undefined;
10
10
  };
11
+ /**
12
+ * Mermaid 配置选项
13
+ */
14
+ export interface MermaidOptions {
15
+ /** 是否启用 Mermaid 渲染,默认 false */
16
+ enabled?: boolean;
17
+ /** 主题 */
18
+ theme?: MermaidTheme | 'auto';
19
+ }
11
20
  /**
12
21
  * Markdown 组件 Props
13
22
  */
@@ -22,6 +31,13 @@ export interface MarkdownProps extends ProcessorOptions {
22
31
  copyButton?: boolean;
23
32
  /** 复制成功回调 */
24
33
  onCodeCopy?: (code: string) => void;
34
+ /**
35
+ * Mermaid 渲染配置
36
+ * - true: 启用默认配置
37
+ * - false: 禁用(默认)
38
+ * - MermaidOptions: 自定义配置
39
+ */
40
+ mermaid?: boolean | MermaidOptions;
25
41
  }
26
42
  /**
27
43
  * useMarkdown Hook 配置
@@ -33,5 +49,7 @@ export interface UseMarkdownOptions extends ProcessorOptions {
33
49
  copyButton?: boolean;
34
50
  /** 复制成功回调 */
35
51
  onCodeCopy?: (code: string) => void;
52
+ /** Mermaid 渲染配置 */
53
+ mermaid?: boolean | MermaidOptions;
36
54
  }
37
55
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,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A+B;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS;IACT,KAAK,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,mBAAmB;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa;IACb,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,cAAc;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa;IACb,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,mBAAmB;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;CACpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superlc/md-react",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "基于 @superlc/md-core 的 React Markdown 渲染组件",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -20,14 +20,20 @@
20
20
  "dependencies": {
21
21
  "hast-util-to-jsx-runtime": "^2.3.0",
22
22
  "katex": "^0.16.28",
23
- "@superlc/md-core": "0.1.1"
23
+ "@superlc/md-core": "0.2.0"
24
24
  },
25
25
  "optionalDependencies": {
26
26
  "dompurify": "^3.0.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": ">=18.0.0",
30
- "react-dom": ">=18.0.0"
30
+ "react-dom": ">=18.0.0",
31
+ "mermaid": ">=10.0.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "mermaid": {
35
+ "optional": true
36
+ }
31
37
  },
32
38
  "devDependencies": {
33
39
  "@types/dompurify": "^3.0.0",