@heikeson/md-engine 0.4.0 → 0.5.1

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.
Files changed (46) hide show
  1. package/README.md +52 -4
  2. package/dist/{chunk-V7T7I5HE.js → chunk-KC6CBSFU.js} +64 -16
  3. package/dist/chunk-KC6CBSFU.js.map +1 -0
  4. package/dist/chunk-OG47YL3H.js +68 -0
  5. package/dist/chunk-OG47YL3H.js.map +1 -0
  6. package/dist/chunk-OJQDOFGL.js +313 -0
  7. package/dist/chunk-OJQDOFGL.js.map +1 -0
  8. package/dist/{chunk-7RXVCGFM.js → chunk-RJZKMZOI.js} +124 -17
  9. package/dist/chunk-RJZKMZOI.js.map +1 -0
  10. package/dist/chunk-YJGGJP2V.js +68 -0
  11. package/dist/chunk-YJGGJP2V.js.map +1 -0
  12. package/dist/components/index.d.ts +3 -3
  13. package/dist/components/index.js +4 -1
  14. package/dist/editor/index.d.ts +20 -3
  15. package/dist/editor/index.js +106 -44
  16. package/dist/editor/index.js.map +1 -1
  17. package/dist/index.d.ts +129 -6
  18. package/dist/index.js +6 -3
  19. package/dist/index.js.map +1 -1
  20. package/dist/locales/en-US.d.ts +68 -0
  21. package/dist/locales/en-US.js +3 -0
  22. package/dist/locales/en-US.js.map +1 -0
  23. package/dist/locales/zh-CN.d.ts +68 -0
  24. package/dist/locales/zh-CN.js +3 -0
  25. package/dist/locales/zh-CN.js.map +1 -0
  26. package/dist/mermaid/index.d.ts +3 -1
  27. package/dist/mermaid/index.js +46 -16
  28. package/dist/mermaid/index.js.map +1 -1
  29. package/dist/{mermaid-placeholder-A1N4puyc.d.ts → mermaid-placeholder-DYfFG3_f.d.ts} +1 -0
  30. package/dist/render-DbUepYgE.d.ts +247 -0
  31. package/dist/styles.css +1 -1
  32. package/package.json +18 -4
  33. package/styles/accordion.css +1 -1
  34. package/styles/callout.css +2 -2
  35. package/styles/cards.css +9 -1
  36. package/styles/editor.css +1 -1
  37. package/styles/files.css +12 -5
  38. package/styles/image.css +5 -5
  39. package/styles/index.css +1 -0
  40. package/styles/mermaid.css +1 -1
  41. package/styles/steps.css +1 -1
  42. package/styles/type-table.css +2 -2
  43. package//345/257/271/346/216/245/345/245/221/347/272/246.md +23 -3
  44. package/dist/chunk-7RXVCGFM.js.map +0 -1
  45. package/dist/chunk-V7T7I5HE.js.map +0 -1
  46. package/dist/render-C5-vIUuK.d.ts +0 -44
@@ -1,44 +0,0 @@
1
- import { ComponentType, ReactElement } from 'react';
2
- import { PluggableList } from 'unified';
3
-
4
- /**
5
- * @file 渲染器(SSR 安全)
6
- * @description 一条 unified 管线:remark-parse(挂尖括号扩展)→ gfm / math → mdast-to-hast
7
- * (自定义 jsxBlock handler)→ slug / katex → React 元素。渲染与解析共用同一套扩展,
8
- * 保证"能解析的就能渲染"。
9
- * @created 2026-10-24 20:24
10
- * @updated 2026-10-24 20:24
11
- * @updated 2026-11-01 21:47 rawBody 容器把源码以 props 交给组件;渲染侧同步 collectMermaid 标记
12
- */
13
-
14
- /** 宿主可覆盖的组件类型 */
15
- type AnyComponent = ComponentType<Record<string, unknown>>;
16
- /** 渲染配置(只增不改,新增项必须有默认值) */
17
- interface RenderConfig {
18
- /** 单组件覆盖逃生舱;未覆盖的继续用包内默认实现 */
19
- components?: Partial<Record<string, AnyComponent>>;
20
- /** 宿主自定义 rehype 插件(须为同步插件,保证 SSR 安全) */
21
- rehypePlugins?: PluggableList;
22
- /** 宿主自定义 remark 插件(在 mdast → hast 之前执行) */
23
- remarkPlugins?: PluggableList;
24
- /**
25
- * 是否在块级元素上输出 `data-src-start`(源码起始 offset)
26
- * @default false
27
- * @description 仅供编辑器分屏做内容对齐的滚动同步;前台文章保持关闭以省体积
28
- */
29
- sourcePositions?: boolean;
30
- }
31
- /** 渲染器参数 */
32
- interface MarkdownRendererProps {
33
- content: string;
34
- className?: string;
35
- config?: RenderConfig;
36
- }
37
- /**
38
- * 渲染 Markdown 为 React 元素
39
- * @param props 内容、外层类名与配置
40
- * @returns 渲染结果
41
- */
42
- declare function MarkdownRenderer({ content, className, config, }: MarkdownRendererProps): ReactElement;
43
-
44
- export { MarkdownRenderer as M, type RenderConfig as R, type MarkdownRendererProps as a };