reactive-md 0.6.0 → 0.6.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 (105) hide show
  1. package/CHANGELOG-ch.md +203 -194
  2. package/CHANGELOG.md +203 -194
  3. package/CONTRIBUTING-ch.md +67 -67
  4. package/CONTRIBUTING.md +69 -69
  5. package/README-ch.md +157 -157
  6. package/README-en.md +184 -184
  7. package/README.md +184 -184
  8. package/SECURITY-ch.md +81 -81
  9. package/SECURITY.md +81 -81
  10. package/THIRD_PARTY_NOTICES.md +313 -209
  11. package/bin/reactive-md.mjs +39 -39
  12. package/cli/args.mjs +181 -181
  13. package/cli/assets.mjs +390 -390
  14. package/cli/build.mjs +268 -268
  15. package/cli/document.mjs +130 -130
  16. package/cli/errors.mjs +61 -61
  17. package/cli/fs-utils.mjs +133 -133
  18. package/cli/glob.mjs +203 -203
  19. package/cli/help.mjs +138 -138
  20. package/cli/lint.mjs +177 -177
  21. package/cli/main.mjs +55 -55
  22. package/cli/migrate.mjs +368 -368
  23. package/cli/package.mjs +210 -210
  24. package/dist-library/{authoring-DSC0VsNK.js → authoring-BEVyth5X.js} +1 -1
  25. package/dist-library/compiler-Cm3ppMxG.js +46044 -0
  26. package/dist-library/{react-Dk94rcOp.js → react-Bh7_oxZp.js} +20110 -20113
  27. package/dist-library/reactive-md-authoring.js +2 -2
  28. package/dist-library/reactive-md-print.css +284 -284
  29. package/dist-library/reactive-md-react-unstyled.js +1 -1
  30. package/dist-library/reactive-md-react.js +1 -1
  31. package/dist-library/reactive-md.css +1 -1
  32. package/dist-library/reactive-md.js +3 -3
  33. package/dist-library/{runtime-D8KbnCd0.js → runtime-DlFYQ4s_.js} +1 -1
  34. package/dist-library/types/local/math-display.d.ts +22 -23
  35. package/dist-library/types/local/math-view.d.ts +6 -7
  36. package/dist-standalone/reactive-md-standalone.css +1 -1
  37. package/dist-standalone/reactive-md-standalone.js +318 -62
  38. package/docs/compatibility/compatibility-ch.md +121 -119
  39. package/docs/compatibility/compatibility-en.md +121 -119
  40. package/docs/compatibility/source-versioning-ch.md +159 -159
  41. package/docs/compatibility/source-versioning-en.md +159 -159
  42. package/docs/development/component-development-ch.md +210 -210
  43. package/docs/development/component-development-en.md +210 -210
  44. package/docs/development/component-protocol-ch.md +747 -747
  45. package/docs/development/component-protocol-en.md +747 -747
  46. package/docs/development/performance-ch.md +76 -76
  47. package/docs/development/performance-en.md +76 -76
  48. package/docs/development/releasing-ch.md +108 -108
  49. package/docs/development/releasing-en.md +108 -108
  50. package/docs/integration/author-tools-ch.md +62 -62
  51. package/docs/integration/author-tools-en.md +62 -62
  52. package/docs/integration/shareable-export-ch.md +209 -209
  53. package/docs/integration/shareable-export-en.md +211 -211
  54. package/docs/reference/computations-formatting-ch.md +87 -87
  55. package/docs/reference/computations-formatting-en.md +87 -87
  56. package/docs/reference/constraints-collections-ch.md +84 -84
  57. package/docs/reference/constraints-collections-en.md +84 -84
  58. package/docs/reference/diagnostics-counting-ch.md +104 -104
  59. package/docs/reference/diagnostics-counting-en.md +104 -104
  60. package/docs/reference/local-components-v2-ch.md +138 -138
  61. package/docs/reference/local-components-v2-en.md +104 -104
  62. package/docs/reference/local-interaction-syntax-ch.md +515 -511
  63. package/docs/reference/local-interaction-syntax-en.md +511 -507
  64. package/docs/reference/theme-protocol-ch.md +107 -107
  65. package/docs/reference/theme-protocol-en.md +107 -107
  66. package/docs/releases/release-0.4.0-ch.md +89 -89
  67. package/docs/releases/release-0.4.0-en.md +89 -89
  68. package/docs/releases/release-0.4.1-ch.md +23 -23
  69. package/docs/releases/release-0.4.1-en.md +23 -23
  70. package/docs/releases/release-0.6.1-ch.md +27 -0
  71. package/docs/releases/release-0.6.1-en.md +27 -0
  72. package/examples/conformance/README.md +53 -53
  73. package/examples/conformance/component-protocol-1.json +482 -482
  74. package/examples/conformance/component-protocol-1.schema.json +76 -76
  75. package/examples/conformance/local-draft-1.json +50 -50
  76. package/examples/conformance/local-draft-2.json +212 -212
  77. package/examples/integration/README.md +47 -47
  78. package/examples/integration/core/index.mjs +32 -32
  79. package/examples/integration/worker/index.html +19 -19
  80. package/examples/integration/worker/main.js +61 -61
  81. package/examples/integration/worker/package.json +13 -13
  82. package/examples/integration/worker/worker.js +3 -3
  83. package/examples/local/README.md +74 -74
  84. package/examples/local/charts.reactive.md +73 -73
  85. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  86. package/examples/local/recipes/invoice.reactive.md +36 -36
  87. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  88. package/examples/local/recipes/workshop.reactive.md +33 -33
  89. package/examples/local/showcase/README.md +25 -25
  90. package/examples/local/showcase/explore.reactive.md +102 -102
  91. package/examples/local/showcase/flow.reactive.md +86 -86
  92. package/examples/local/showcase/forms.reactive.md +126 -126
  93. package/examples/local/showcase/functions.reactive.md +119 -119
  94. package/examples/local/showcase/layout.reactive.md +100 -100
  95. package/examples/local/showcase/statistics.reactive.md +108 -108
  96. package/examples/local/showcase/tasks.reactive.md +89 -89
  97. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  98. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  99. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  100. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  101. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  102. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  103. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  104. package/package.json +152 -152
  105. package/dist-library/compiler-CRD88BMt.js +0 -24964
@@ -1,67 +1,67 @@
1
- # 贡献指南
2
-
3
- Reactive MD 是 `local-draft-2` 的 0.x 预览实现。贡献可以包括语法、编译器、运行时、React 渲染器、文档、示例和 Demo。开始前先读[版本与兼容性](docs/compatibility/compatibility-ch.md)和[本地交互语法规范](docs/reference/local-interaction-syntax-ch.md)。
4
-
5
- 新增或修改组块时,按[组块协议](docs/development/component-protocol-ch.md)明确行为,使用[开发指南中的提案模板](docs/development/component-development-ch.md)记录声明、兼容性和验收证据。这里的组块包括控件、容器、可视化和结构子项。
6
-
7
- ## 环境
8
-
9
- - Node.js 22.12 或更新版本。
10
- - 仓库使用 npm workspaces;在根目录执行 `npm ci`。
11
- - 不提交 `node_modules/`、`dist-library/`、`demo/dist/`、`demo/artifacts/` 或 `.tasks/`。
12
-
13
- ## 开发与检查
14
-
15
- ```sh
16
- npm ci
17
- npm run verify:release
18
- ```
19
-
20
- | 命令 | 覆盖内容 |
21
- | --- | --- |
22
- | `npm run build` | 类型检查与语言包构建 |
23
- | `npm test` | 编译器、表达式、LaTeX、运行时和渲染器测试 |
24
- | `npm run test:components` | 组块协议的代表性用例和已有语言验收数据;新增组块还需自己的针对性测试 |
25
- | `npm run test:package` | 公开入口、示例可编译和样式边界;需先构建 |
26
- | `npm run test:packed` | 真实 tarball 的独立离线安装、核心和 React 严格类型检查、CSS 导出与静态 SSR |
27
- | `npm run notices` | 从已安装依赖生成第三方许可证清单 |
28
- | `npm run benchmark` | Node 编译、运行时和绘图性能;报告写入 `artifacts/benchmark.json` |
29
- | `npm run test:docs` | 文档相对链接和标题锚点 |
30
- | `npm run build:demo`、`npm run test:demo` | Demo 构建与示例索引 |
31
- | `npm run test:browser:core` | Firefox 与 WebKit 在 1280px、375px 下的核心流程;使用已构建 Demo,并自行管理预览服务 |
32
- | `npm run verify:release` | 完整发布门禁:核心与 Demo 测试、类型、第三方声明、包与文档检查、仓库外真实 tarball 消费,以及计算、集合、作者工具、状态恢复、HTML 导出和渲染等价的浏览器检查。自行管理预览服务生命周期 |
33
-
34
- CI 通过 `npm run verify:release:node` 和 `npm run verify:release:browser` 分片运行同一门禁。汇总与逐步日志写入 `artifacts/release-verification.json` 和 `artifacts/release-verification/`;经过验证的原始 tarball 及 SHA256 记录保留在 `artifacts/release-package/`。本机需已安装浏览器,门禁不会自动安装。
35
-
36
- 浏览器检查需要先启动 Demo,并准备本机浏览器。完整门禁会自行管理这些依赖;单独运行浏览器脚本时,默认地址是 `http://127.0.0.1:5173`,可用 `DEMO_URL` 指向其他地址。报告写入 `demo/artifacts/`。本地默认使用 Edge,CI 在 Linux 上使用 Playwright 的 Chromium(`PLAYWRIGHT_CHANNEL=chromium`)。
37
-
38
- 浏览器发布门禁保留 Chromium 完整验证,并增加 Playwright Firefox、WebKit 的核心流程。通过 `npm exec --workspace=@reactive-md/demo -- playwright install firefox webkit` 安装匹配的运行时;CI 使用 `--with-deps` 安装三个引擎。先运行 `npm run build:demo`,再运行 `npm run test:browser:core`;也可用 `node scripts/verify-browser-core.mjs --browser=webkit` 选择单个引擎,或用 `DEMO_URL` 复用已有服务。报告、截图与下载的 HTML 按引擎写入 `artifacts/browser-core/`。缺少浏览器或检查失败时,命令会失败。
39
-
40
- 核心流程覆盖示例、控件与计算、条件、日期、表格、图表、图解、编辑与诊断、个人文档保存与副本、语言切换、指南代码块主题、键盘菜单,以及 Markdown 和交互 HTML 下载。导出的 HTML 从磁盘重新打开,在阻止外部请求的条件下验证交互。WebKit 引擎检查不等同于 Apple 设备上的 Safari 实机测试。
41
-
42
- ```sh
43
- npm run dev
44
- # 另一个终端
45
- npm run test:browser
46
- ```
47
-
48
- 修改语言包后重新运行 `npm run build:lib`,或使用 `npm run dev:lib` 监听重建。
49
-
50
- 性能测量条件与当前基线见[性能说明](docs/development/performance-ch.md),跨实现可复用的输入与预期结果见[语言验收数据](examples/conformance/README.md)。
51
-
52
- ## 改动要求
53
-
54
- - 保持改动聚焦。行为变化附带测试;用户可见变化更新文档和相关示例。
55
- - 语法或公开 API 的破坏性变化先更新[版本与兼容性](docs/compatibility/compatibility-ch.md)和[变更记录](CHANGELOG-ch.md),说明旧写法、新写法和迁移方式。不要在没有语法修订的情况下悄悄改变作者语法。
56
- - 新组件或新属性必须同时实现编译校验、运行时约束、渲染、可访问名称和资源边界。不要只加展示样式。
57
- - 组块提案须给出属性与子内容声明、状态与生命周期规则、诊断、资源预算、兼容分类和对应验收结果;参考 `slider`、`tabs`、`plot` 的[协议验收数据](examples/conformance/README.md)。协议修订不自动改变包版本、语法修订或公开 API。
58
- - 资源上限集中在 `src/local/limits.ts`;新增无界输入、循环、递归或绘图计算时,先定义预算。
59
- - 不引入网络请求、任意 HTML、事件处理器、作者 CSS 或持久化状态。这些不在当前范围内。
60
- - 更新中文文档时保持与现有术语一致;英文 README 保持简洁,不重复工程细节。
61
- - 不要提交凭据、`.npmrc` token 或个人路径。不要手工修改 `dist-library/`;它由构建生成。
62
-
63
- ## 提交与 PR
64
-
65
- - PR 说明写清目的、受影响范围和验证命令及结果。没有运行的检查要明确写出,不要写成已通过。
66
- - 涉及安全的问题不要开公开 issue,按[安全策略](SECURITY-ch.md)处理。
67
- - 发布是维护者的手工流程,见[发布清单](docs/development/releasing-ch.md)。贡献者不需要接触 npm 凭据。
1
+ # 贡献指南
2
+
3
+ Reactive MD 是 `local-draft-2` 的 0.x 预览实现。贡献可以包括语法、编译器、运行时、React 渲染器、文档、示例和 Demo。开始前先读[版本与兼容性](docs/compatibility/compatibility-ch.md)和[本地交互语法规范](docs/reference/local-interaction-syntax-ch.md)。
4
+
5
+ 新增或修改组块时,按[组块协议](docs/development/component-protocol-ch.md)明确行为,使用[开发指南中的提案模板](docs/development/component-development-ch.md)记录声明、兼容性和验收证据。这里的组块包括控件、容器、可视化和结构子项。
6
+
7
+ ## 环境
8
+
9
+ - Node.js 22.12 或更新版本。
10
+ - 仓库使用 npm workspaces;在根目录执行 `npm ci`。
11
+ - 不提交 `node_modules/`、`dist-library/`、`demo/dist/`、`demo/artifacts/` 或 `.tasks/`。
12
+
13
+ ## 开发与检查
14
+
15
+ ```sh
16
+ npm ci
17
+ npm run verify:release
18
+ ```
19
+
20
+ | 命令 | 覆盖内容 |
21
+ | --- | --- |
22
+ | `npm run build` | 类型检查与语言包构建 |
23
+ | `npm test` | 编译器、表达式、LaTeX、运行时和渲染器测试 |
24
+ | `npm run test:components` | 组块协议的代表性用例和已有语言验收数据;新增组块还需自己的针对性测试 |
25
+ | `npm run test:package` | 公开入口、示例可编译和样式边界;需先构建 |
26
+ | `npm run test:packed` | 真实 tarball 的独立离线安装、核心和 React 严格类型检查、CSS 导出与静态 SSR |
27
+ | `npm run notices` | 从已安装依赖生成第三方许可证清单 |
28
+ | `npm run benchmark` | Node 编译、运行时和绘图性能;报告写入 `artifacts/benchmark.json` |
29
+ | `npm run test:docs` | 文档相对链接和标题锚点 |
30
+ | `npm run build:demo`、`npm run test:demo` | Demo 构建与示例索引 |
31
+ | `npm run test:browser:core` | Firefox 与 WebKit 在 1280px、375px 下的核心流程;使用已构建 Demo,并自行管理预览服务 |
32
+ | `npm run verify:release` | 完整发布门禁:核心与 Demo 测试、类型、第三方声明、包与文档检查、仓库外真实 tarball 消费,以及计算、集合、作者工具、状态恢复、HTML 导出和渲染等价的浏览器检查。自行管理预览服务生命周期 |
33
+
34
+ CI 通过 `npm run verify:release:node` 和 `npm run verify:release:browser` 分片运行同一门禁。汇总与逐步日志写入 `artifacts/release-verification.json` 和 `artifacts/release-verification/`;经过验证的原始 tarball 及 SHA256 记录保留在 `artifacts/release-package/`。本机需已安装浏览器,门禁不会自动安装。
35
+
36
+ 浏览器检查需要先启动 Demo,并准备本机浏览器。完整门禁会自行管理这些依赖;单独运行浏览器脚本时,默认地址是 `http://127.0.0.1:5173`,可用 `DEMO_URL` 指向其他地址。报告写入 `demo/artifacts/`。本地默认使用 Edge,CI 在 Linux 上使用 Playwright 的 Chromium(`PLAYWRIGHT_CHANNEL=chromium`)。
37
+
38
+ 浏览器发布门禁保留 Chromium 完整验证,并增加 Playwright Firefox、WebKit 的核心流程。通过 `npm exec --workspace=@reactive-md/demo -- playwright install firefox webkit` 安装匹配的运行时;CI 使用 `--with-deps` 安装三个引擎。先运行 `npm run build:demo`,再运行 `npm run test:browser:core`;也可用 `node scripts/verify-browser-core.mjs --browser=webkit` 选择单个引擎,或用 `DEMO_URL` 复用已有服务。报告、截图与下载的 HTML 按引擎写入 `artifacts/browser-core/`。缺少浏览器或检查失败时,命令会失败。
39
+
40
+ 核心流程覆盖示例、控件与计算、条件、日期、表格、图表、图解、编辑与诊断、个人文档保存与副本、语言切换、指南代码块主题、键盘菜单,以及 Markdown 和交互 HTML 下载。导出的 HTML 从磁盘重新打开,在阻止外部请求的条件下验证交互。WebKit 引擎检查不等同于 Apple 设备上的 Safari 实机测试。
41
+
42
+ ```sh
43
+ npm run dev
44
+ # 另一个终端
45
+ npm run test:browser
46
+ ```
47
+
48
+ 修改语言包后重新运行 `npm run build:lib`,或使用 `npm run dev:lib` 监听重建。
49
+
50
+ 性能测量条件与当前基线见[性能说明](docs/development/performance-ch.md),跨实现可复用的输入与预期结果见[语言验收数据](examples/conformance/README.md)。
51
+
52
+ ## 改动要求
53
+
54
+ - 保持改动聚焦。行为变化附带测试;用户可见变化更新文档和相关示例。
55
+ - 语法或公开 API 的破坏性变化先更新[版本与兼容性](docs/compatibility/compatibility-ch.md)和[变更记录](CHANGELOG-ch.md),说明旧写法、新写法和迁移方式。不要在没有语法修订的情况下悄悄改变作者语法。
56
+ - 新组件或新属性必须同时实现编译校验、运行时约束、渲染、可访问名称和资源边界。不要只加展示样式。
57
+ - 组块提案须给出属性与子内容声明、状态与生命周期规则、诊断、资源预算、兼容分类和对应验收结果;参考 `slider`、`tabs`、`plot` 的[协议验收数据](examples/conformance/README.md)。协议修订不自动改变包版本、语法修订或公开 API。
58
+ - 资源上限集中在 `src/local/limits.ts`;新增无界输入、循环、递归或绘图计算时,先定义预算。
59
+ - 不引入网络请求、任意 HTML、事件处理器、作者 CSS 或持久化状态。这些不在当前范围内。
60
+ - 更新中文文档时保持与现有术语一致;英文 README 保持简洁,不重复工程细节。
61
+ - 不要提交凭据、`.npmrc` token 或个人路径。不要手工修改 `dist-library/`;它由构建生成。
62
+
63
+ ## 提交与 PR
64
+
65
+ - PR 说明写清目的、受影响范围和验证命令及结果。没有运行的检查要明确写出,不要写成已通过。
66
+ - 涉及安全的问题不要开公开 issue,按[安全策略](SECURITY-ch.md)处理。
67
+ - 发布是维护者的手工流程,见[发布清单](docs/development/releasing-ch.md)。贡献者不需要接触 npm 凭据。
package/CONTRIBUTING.md CHANGED
@@ -1,69 +1,69 @@
1
- # Contributing
2
-
3
- Reactive MD is a 0.x preview implementation of `local-draft-2`. Contributions can cover syntax, the compiler, the runtime, the React renderer, documentation, examples and the demo. Before starting, read [Versions and compatibility](docs/compatibility/compatibility-en.md) and the [local interaction syntax specification](docs/reference/local-interaction-syntax-en.md).
4
-
5
- When adding or changing a component, define its behavior according to the [component protocol](docs/development/component-protocol-en.md), and use the [proposal template in the development guide](docs/development/component-development-en.md) to record declarations, compatibility and acceptance evidence. Components here include input controls, containers, visualizations and structural children.
6
-
7
- ## Environment
8
-
9
- - Node.js 22.12 or newer.
10
- - The repository uses npm workspaces; run `npm ci` from the root.
11
- - Do not commit `node_modules/`, `dist-library/`, `demo/dist/`, `demo/artifacts/` or `.tasks/`.
12
-
13
- ## Development and checks
14
-
15
- ```sh
16
- npm ci
17
- npm run verify:release
18
- ```
19
-
20
- | Command | What it covers |
21
- | --- | --- |
22
- | `npm run build` | Type checking and the language package build |
23
- | `npm test` | Compiler, expression, LaTeX, runtime and renderer tests |
24
- | `npm run lint -- <file>` | Author diagnostics for one or more documents; requires a prior build |
25
- | `npm run test:diagnostics --workspace=@reactive-md/demo` | Browser checks for diagnostic localization, source jumps and Unicode text constraints; requires a running demo |
26
- | `npm run test:components` | Representative cases for the component protocol and existing language acceptance data; new components still need their own targeted tests |
27
- | `npm run test:package` | Public entries, example compilation and style boundaries; requires a prior build |
28
- | `npm run test:packed` | Standalone offline install of the real tarball, strict type checking for core and React, CSS exports and static SSR |
29
- | `npm run notices` | Generate the third-party license inventory from installed dependencies |
30
- | `npm run benchmark` | Node compile, runtime and plotting performance; the report is written to `artifacts/benchmark.json` |
31
- | `npm run test:docs` | Documentation relative links and heading anchors |
32
- | `npm run build:demo`, `npm run test:demo` | Demo build and example index |
33
- | `npm run test:browser:core` | Firefox and WebKit core workflows at 1280px and 375px; uses the built demo and manages its preview server |
34
- | `npm run verify:release` | Complete release gate: core and demo tests, types, notices, package and documentation checks, packed consumption outside the repository, and browser checks for calculations, collections, authoring, state restoration, HTML export and rendering equivalence. It manages the preview server lifecycle |
35
-
36
- CI uses `npm run verify:release:node` and `npm run verify:release:browser` to split the same gate. Reports and step logs go to `artifacts/release-verification.json` and `artifacts/release-verification/`; the exact verified tarball and its SHA256 record go to `artifacts/release-package/`. A local browser must already be installed; the gate does not install one.
37
-
38
- Browser checks require the demo to be running and a local browser available. The complete gate manages those dependencies itself; when running individual browser scripts, the default address is `http://127.0.0.1:5173` and `DEMO_URL` can point at another address. Reports are written to `demo/artifacts/`. Local runs use Edge by default; CI uses Playwright Chromium on Linux (`PLAYWRIGHT_CHANNEL=chromium`).
39
-
40
- The browser release gate keeps the full Chromium suite and adds core workflows in Playwright Firefox and WebKit. Install the matching runtimes with `npm exec --workspace=@reactive-md/demo -- playwright install firefox webkit` (CI installs all three engines with `--with-deps`). After `npm run build:demo`, run `npm run test:browser:core`, or select one engine with `node scripts/verify-browser-core.mjs --browser=webkit`. `DEMO_URL` can reuse an existing server. Reports, screenshots and downloaded HTML go to `artifacts/browser-core/`, grouped by engine. A missing browser or failed check makes the command fail.
41
-
42
- The core gate covers examples, controls and calculations, conditions, dates, tables, charts, diagrams, editing and diagnostics, personal document persistence and copies, language switching, guide code themes, keyboard menus, and Markdown/interactive HTML downloads. Exported HTML is reopened from disk and exercised with external requests blocked. WebKit engine checks do not substitute for testing Safari on an Apple device.
43
-
44
- ```sh
45
- npm run dev
46
- # another terminal
47
- npm run test:browser
48
- ```
49
-
50
- After changing the language package, rerun `npm run build:lib`, or use `npm run dev:lib` to watch and rebuild.
51
-
52
- Performance measurement conditions and current baselines are in [Performance measurements](docs/development/performance-en.md); reusable inputs and expected results across implementations are in the [language conformance data](examples/conformance/README.md).
53
-
54
- ## Change requirements
55
-
56
- - Keep changes focused. Add tests for behavior changes; update documentation and relevant examples for user-visible changes.
57
- - For breaking changes to syntax or the public API, first update [Versions and compatibility](docs/compatibility/compatibility-en.md) and the [changelog](CHANGELOG.md), describing the old form, the new form and the migration path. Do not silently change author syntax without a syntax revision.
58
- - New components or attributes must implement compile validation, runtime constraints, rendering, accessible names and resource boundaries together. Do not add display styling only.
59
- - A component proposal must state attribute and child-content declarations, state and lifecycle rules, diagnostics, resource budgets, compatibility classification and corresponding acceptance results; see the [protocol acceptance data](examples/conformance/README.md) for `slider`, `tabs` and `plot`. A protocol revision does not automatically change the package version, syntax revision or public API.
60
- - Resource limits are centralized in `src/local/limits.ts`; when adding unbounded input, loops, recursion or plotting computation, define a budget first.
61
- - Do not introduce network requests, arbitrary HTML, event handlers, author CSS or persisted state. These are out of the current scope.
62
- - Keep terminology consistent with the existing documentation; keep the English README concise and do not repeat engineering details.
63
- - Do not commit credentials, `.npmrc` tokens or personal paths. Do not edit `dist-library/` by hand; it is generated by the build.
64
-
65
- ## Commits and pull requests
66
-
67
- - Describe the purpose, affected scope, verification commands and results in the PR. State any checks you did not run explicitly instead of presenting them as passed.
68
- - Do not open a public issue for security matters; follow the [security policy](SECURITY.md).
69
- - Releases are a manual maintainer process; see the [release checklist](docs/development/releasing-en.md). Contributors do not need npm credentials.
1
+ # Contributing
2
+
3
+ Reactive MD is a 0.x preview implementation of `local-draft-2`. Contributions can cover syntax, the compiler, the runtime, the React renderer, documentation, examples and the demo. Before starting, read [Versions and compatibility](docs/compatibility/compatibility-en.md) and the [local interaction syntax specification](docs/reference/local-interaction-syntax-en.md).
4
+
5
+ When adding or changing a component, define its behavior according to the [component protocol](docs/development/component-protocol-en.md), and use the [proposal template in the development guide](docs/development/component-development-en.md) to record declarations, compatibility and acceptance evidence. Components here include input controls, containers, visualizations and structural children.
6
+
7
+ ## Environment
8
+
9
+ - Node.js 22.12 or newer.
10
+ - The repository uses npm workspaces; run `npm ci` from the root.
11
+ - Do not commit `node_modules/`, `dist-library/`, `demo/dist/`, `demo/artifacts/` or `.tasks/`.
12
+
13
+ ## Development and checks
14
+
15
+ ```sh
16
+ npm ci
17
+ npm run verify:release
18
+ ```
19
+
20
+ | Command | What it covers |
21
+ | --- | --- |
22
+ | `npm run build` | Type checking and the language package build |
23
+ | `npm test` | Compiler, expression, LaTeX, runtime and renderer tests |
24
+ | `npm run lint -- <file>` | Author diagnostics for one or more documents; requires a prior build |
25
+ | `npm run test:diagnostics --workspace=@reactive-md/demo` | Browser checks for diagnostic localization, source jumps and Unicode text constraints; requires a running demo |
26
+ | `npm run test:components` | Representative cases for the component protocol and existing language acceptance data; new components still need their own targeted tests |
27
+ | `npm run test:package` | Public entries, example compilation and style boundaries; requires a prior build |
28
+ | `npm run test:packed` | Standalone offline install of the real tarball, strict type checking for core and React, CSS exports and static SSR |
29
+ | `npm run notices` | Generate the third-party license inventory from installed dependencies |
30
+ | `npm run benchmark` | Node compile, runtime and plotting performance; the report is written to `artifacts/benchmark.json` |
31
+ | `npm run test:docs` | Documentation relative links and heading anchors |
32
+ | `npm run build:demo`, `npm run test:demo` | Demo build and example index |
33
+ | `npm run test:browser:core` | Firefox and WebKit core workflows at 1280px and 375px; uses the built demo and manages its preview server |
34
+ | `npm run verify:release` | Complete release gate: core and demo tests, types, notices, package and documentation checks, packed consumption outside the repository, and browser checks for calculations, collections, authoring, state restoration, HTML export and rendering equivalence. It manages the preview server lifecycle |
35
+
36
+ CI uses `npm run verify:release:node` and `npm run verify:release:browser` to split the same gate. Reports and step logs go to `artifacts/release-verification.json` and `artifacts/release-verification/`; the exact verified tarball and its SHA256 record go to `artifacts/release-package/`. A local browser must already be installed; the gate does not install one.
37
+
38
+ Browser checks require the demo to be running and a local browser available. The complete gate manages those dependencies itself; when running individual browser scripts, the default address is `http://127.0.0.1:5173` and `DEMO_URL` can point at another address. Reports are written to `demo/artifacts/`. Local runs use Edge by default; CI uses Playwright Chromium on Linux (`PLAYWRIGHT_CHANNEL=chromium`).
39
+
40
+ The browser release gate keeps the full Chromium suite and adds core workflows in Playwright Firefox and WebKit. Install the matching runtimes with `npm exec --workspace=@reactive-md/demo -- playwright install firefox webkit` (CI installs all three engines with `--with-deps`). After `npm run build:demo`, run `npm run test:browser:core`, or select one engine with `node scripts/verify-browser-core.mjs --browser=webkit`. `DEMO_URL` can reuse an existing server. Reports, screenshots and downloaded HTML go to `artifacts/browser-core/`, grouped by engine. A missing browser or failed check makes the command fail.
41
+
42
+ The core gate covers examples, controls and calculations, conditions, dates, tables, charts, diagrams, editing and diagnostics, personal document persistence and copies, language switching, guide code themes, keyboard menus, and Markdown/interactive HTML downloads. Exported HTML is reopened from disk and exercised with external requests blocked. WebKit engine checks do not substitute for testing Safari on an Apple device.
43
+
44
+ ```sh
45
+ npm run dev
46
+ # another terminal
47
+ npm run test:browser
48
+ ```
49
+
50
+ After changing the language package, rerun `npm run build:lib`, or use `npm run dev:lib` to watch and rebuild.
51
+
52
+ Performance measurement conditions and current baselines are in [Performance measurements](docs/development/performance-en.md); reusable inputs and expected results across implementations are in the [language conformance data](examples/conformance/README.md).
53
+
54
+ ## Change requirements
55
+
56
+ - Keep changes focused. Add tests for behavior changes; update documentation and relevant examples for user-visible changes.
57
+ - For breaking changes to syntax or the public API, first update [Versions and compatibility](docs/compatibility/compatibility-en.md) and the [changelog](CHANGELOG.md), describing the old form, the new form and the migration path. Do not silently change author syntax without a syntax revision.
58
+ - New components or attributes must implement compile validation, runtime constraints, rendering, accessible names and resource boundaries together. Do not add display styling only.
59
+ - A component proposal must state attribute and child-content declarations, state and lifecycle rules, diagnostics, resource budgets, compatibility classification and corresponding acceptance results; see the [protocol acceptance data](examples/conformance/README.md) for `slider`, `tabs` and `plot`. A protocol revision does not automatically change the package version, syntax revision or public API.
60
+ - Resource limits are centralized in `src/local/limits.ts`; when adding unbounded input, loops, recursion or plotting computation, define a budget first.
61
+ - Do not introduce network requests, arbitrary HTML, event handlers, author CSS or persisted state. These are out of the current scope.
62
+ - Keep terminology consistent with the existing documentation; keep the English README concise and do not repeat engineering details.
63
+ - Do not commit credentials, `.npmrc` tokens or personal paths. Do not edit `dist-library/` by hand; it is generated by the build.
64
+
65
+ ## Commits and pull requests
66
+
67
+ - Describe the purpose, affected scope, verification commands and results in the PR. State any checks you did not run explicitly instead of presenting them as passed.
68
+ - Do not open a public issue for security matters; follow the [security policy](SECURITY.md).
69
+ - Releases are a manual maintainer process; see the [release checklist](docs/development/releasing-en.md). Contributors do not need npm credentials.
package/README-ch.md CHANGED
@@ -1,157 +1,157 @@
1
- # Reactive MD
2
-
3
- [English](README.md)
4
-
5
- 用 Markdown 写本地交互文档。放入输入控件,用 `bind` 命名参数,用 `{{ 表达式 }}` 连接文字、公式、图表和图解。文档作者无需编写 JavaScript 或 CSS。
6
-
7
- 本地模式采用 HTML 风格标签,参数和表格数据直接写在正文中,LaTeX 公式可用于函数绘图。TypeScript 核心和 React 渲染器可独立集成。`0.6.0` 同时提供于 `latest` 与 `next` 渠道,新增原生 HTML 表格、扩展数学与代码高亮、分层图解和表单修复。语法修订继续为 `local-draft-2`,组块协议为 `component-protocol-2`。
8
-
9
- ## 从这里开始
10
-
11
- - [文档导航](docs/README.md):按入门、参考、集成、兼容、开发维护与发布记录查阅。
12
- - [新用户入门指南](docs/guides/local-guide-ch.md):从 Markdown 过渡到交互文档,含完整练习与错误速查。
13
- - [本地交互语法规范](docs/reference/local-interaction-syntax-ch.md) · [功能演示与示例](examples/local/README.md):48 个标签名、标签、就地参数与 LaTeX 绘图。
14
- - [本地模式集成](docs/integration/local-integration-ch.md):`compileLocal`、状态运行时、React 嵌入、URL 策略与样式作用域。
15
- - [HTML 部分兼容](docs/reference/html-compatibility-ch.md):P0 HTML 与下个发行版针对作者 CSS、JavaScript 和扩展 HTML 的暂时性分流政策。
16
- - [可分享文档与静态导出](docs/integration/shareable-export-ch.md):单文件交互 HTML、静态输出、版本化状态文件、图片资源、CLI 与独立浏览器 API。
17
- - [主题协议](docs/reference/theme-protocol-ch.md):文档主题选择、自定义 CSS 与深浅模式。
18
- - [作者工具](docs/integration/author-tools-ch.md):源码高亮、补全、绑定定位、重命名、格式化与命令行检查。
19
- - [React 源码编辑器](docs/integration/editor-ch.md):受控编辑器、属性、ref 句柄、诊断、语言、主题与历史。
20
- - [独立接入示例](examples/integration/README.md):可复制到仓库外运行的 Node 核心和 React 页面。
21
- - [版本与兼容性](docs/compatibility/compatibility-ch.md):0.x 规则、迁移、诊断契约和平台范围。
22
- - [组块协议](docs/development/component-protocol-ch.md) · [组块开发指南](docs/development/component-development-ch.md):新增组件的声明、行为契约和兼容性验收。
23
- - [0.6.0 发布说明](docs/releases/release-0.6.0-ch.md):原生 HTML 表格、数学与代码高亮、分层图解和宿主修复。
24
- - [0.5.3 发布说明](docs/releases/release-0.5.3-ch.md):宿主集成补丁与作者工具。
25
- - [0.5.1 发布说明](docs/releases/release-0.5.1-ch.md):编辑器视图与主题,以及 HTML 兼容。
26
- - [0.5.0 发布说明](docs/releases/release-0.5.0-ch.md):编辑器入口与文档渲染修复。
27
- - [0.4.1 发布说明](docs/releases/release-0.4.1-ch.md):界面与交互修复,兼容 0.4.0。
28
- - [0.4.0 发布与迁移](docs/releases/release-0.4.0-ch.md):本 minor 系列包含的能力,以及从 `0.3.1` / `local-draft-1` 升级的方法。
29
-
30
- ## 写一份文档
31
-
32
- ```markdown
33
- <panel title="费用估算">
34
- <slider bind="people" label="人数" initial="2" min="1" max="20">
35
- <toggle bind="annual" label="年度付款">
36
- </panel>
37
-
38
- 每月费用:**{{ people * (annual ? 80 : 100) }} 元**。
39
- ```
40
-
41
- 输入立即更新结果,面板自带“恢复默认”。独立使用的计数器只需一行 `<counter label="人数">`。
42
-
43
- `0.4.0` 新增 `local-draft-2`、命名计算、校验、集合、主题和离线 HTML 导出;旧版 `0.3.1` 使用 `local-draft-1`。见[0.4.0 发布与迁移](docs/releases/release-0.4.0-ch.md)。
44
-
45
- ## 安装
46
-
47
- 需要 Node.js 22.12 或更新版本,包提供 ESM 入口:
48
-
49
- ```sh
50
- npm install reactive-md
51
- ```
52
-
53
- `latest` 与 `next` 当前都指向 `0.6.0`:
54
-
55
- ```sh
56
- npm install reactive-md
57
- # 或固定版本
58
- npm install reactive-md@0.6.0
59
- ```
60
-
61
- 本版本说明见[0.6.0 发布说明](docs/releases/release-0.6.0-ch.md);从 `0.3.1` / `local-draft-1` 升级前请阅读[迁移说明](docs/releases/release-0.4.0-ch.md)。
62
-
63
- `reactive-md` 入口提供本地编译器、表达式和运行时,`reactive-md/react` 提供 React 渲染器。组件样式通过 `reactive-md/styles.css` 引入。`reactive-md/editor` 提供源码编辑器,并使用独立样式 `reactive-md/editor/styles.css`。现有渲染器和样式导入在 0.6.0 中保持不变。
64
-
65
- React 入口需要 React 19:
66
-
67
- ```sh
68
- npm install react@19 react-dom@19
69
- ```
70
-
71
- ```tsx
72
- import { LocalReactiveDocument } from 'reactive-md/react';
73
- import 'reactive-md/styles.css';
74
-
75
- export function Article({ source }: { source: string }) {
76
- return <LocalReactiveDocument source={source} />;
77
- }
78
- ```
79
-
80
- `reactive-md` 核心入口不依赖 React。完整的编译与运行时 API、宿主 URL 策略、生命周期和样式覆盖见[本地模式集成](docs/integration/local-integration-ch.md)。
81
-
82
- ## 用 React 编辑源码
83
-
84
- 0.5.x 预览版在 `reactive-md/editor` 提供可复用的源码编辑器,样式位于 `reactive-md/editor/styles.css`。组件是受控的,需要 React 19:
85
-
86
- ```tsx
87
- import { useState } from 'react';
88
- import { ReactiveMarkdownEditor } from 'reactive-md/editor';
89
- import 'reactive-md/editor/styles.css';
90
-
91
- export function Editor() {
92
- const [source, setSource] = useState('# 笔记');
93
- return <ReactiveMarkdownEditor value={source} onChange={setSource} />;
94
- }
95
- ```
96
-
97
- 编辑器处理高亮、格式与插入工具、补全、绑定工具、撤销重做及行号。它不编译、不渲染预览;源码由应用保存,并用 `reactive-md/react` 渲染。属性、ref 句柄、诊断、主题、语言和历史规则见 [React 源码编辑器](docs/integration/editor-ch.md)。
98
-
99
- 0.x 次版本可能包含破坏性变更。升级前阅读[变更记录](CHANGELOG-ch.md)与[兼容规则](docs/compatibility/compatibility-ch.md),并保存原始 `.reactive.md` 源码。
100
-
101
- ## 分享文档
102
-
103
- 构建读者可以离线打开的单个 HTML 文件,或不含脚本的静态快照:
104
-
105
- ```sh
106
- npm run build
107
- npx reactive-md build examples/local/counter.reactive.md -o counter.html
108
- npx reactive-md build examples/local/counter.reactive.md -o counter-static.html --mode static
109
- ```
110
-
111
- 交互文件内嵌原始源码、React 19、运行时、样式以及经过校验的本地图片。它先渲染静态首屏,因此禁用 JavaScript 时仍可阅读。使用 `--state-file doc.state.json` 导出已保存的 `reactive-md-state/v1` 基线;省略时使用作者初值,并把它作为读者的重置基线。Demo 导出对话框可以把当前预览参数保存成此类状态文件。
112
-
113
- 图片上限、CSP/安全、打印、退出码、`ReactiveMD.mount`/`mountAll` 与 `<reactive-md-doc>` 见[可分享文档与静态导出](docs/integration/shareable-export-ch.md)。CI 在 Chromium 上运行完整浏览器门禁,并使用 Firefox 与 WebKit 运行核心工作流;本机浏览器检查使用 Microsoft Edge。Firefox 与 WebKit 的完整交互套件和通用 SSR 水合仍未验证。
114
-
115
- ## 体验 Demo
116
-
117
- ```sh
118
- npm ci
119
- npm run dev
120
- ```
121
-
122
- 该命令先构建语言包,再启动独立的 `demo/` 应用,地址为 `http://127.0.0.1:5173`。`/embed.html` 展示嵌入方式。页面顶部的语言按钮可以在中文和英文之间切换,选择会保存在浏览器中。Demo 的页面、编辑器、演示服务、资产和浏览器检查均在 `demo/`,通过语言包的公开入口集成。
123
-
124
- ## 仓库结构
125
-
126
- ```text
127
- src/ 本地语法编译、表达式、运行时和 React 渲染器
128
- examples/ 可复制的本地交互示例,与 demo 应用无关
129
- docs/ 本地语法规范、集成与发布文档
130
- tests/ 语言与渲染器测试
131
- demo/ 独立的 Playground 应用
132
- ```
133
-
134
- ## 文档
135
-
136
- - [新用户入门指南](docs/guides/local-guide-ch.md)与[本地交互语法规范](docs/reference/local-interaction-syntax-ch.md)。
137
- - [本地模式集成](docs/integration/local-integration-ch.md):核心与 React API、URL 策略、生命周期、样式和版本固定。
138
- - [可分享文档与静态导出](docs/integration/shareable-export-ch.md):CLI build/lint、状态文件、本地图片内联、打印与独立浏览器运行时。
139
- - [功能演示与示例](examples/local/README.md)与[独立接入示例](examples/integration/README.md)。
140
- - [React 源码编辑器](docs/integration/editor-ch.md):编辑 `.reactive.md` 源码的受控组件,使用独立样式表。
141
- - [版本与兼容性](docs/compatibility/compatibility-ch.md)、[0.6.0 发布说明](docs/releases/release-0.6.0-ch.md)与[0.5.1 发布说明](docs/releases/release-0.5.1-ch.md)。
142
- - [0.4.0 发布与迁移](docs/releases/release-0.4.0-ch.md)。
143
- - [组块协议](docs/development/component-protocol-ch.md)与[组块开发指南](docs/development/component-development-ch.md)。
144
- - [性能说明](docs/development/performance-ch.md)与[发布清单](docs/development/releasing-ch.md)。
145
-
146
- 更多开发与测试命令见[贡献指南](CONTRIBUTING-ch.md)。
147
-
148
- ## 贡献与安全
149
-
150
- - [贡献指南](CONTRIBUTING-ch.md):环境、检查命令和改动要求。
151
- - [安全策略](SECURITY-ch.md):威胁边界、资源上限、宿主责任和漏洞报告渠道。
152
- - [变更记录](CHANGELOG-ch.md)。
153
- - [发布清单](docs/development/releasing-ch.md):验证门禁、notice、tarball 和人工发布流程。
154
-
155
- ## 许可证
156
-
157
- [MIT](LICENSE)
1
+ # Reactive MD
2
+
3
+ [English](README.md)
4
+
5
+ 用 Markdown 写本地交互文档。放入输入控件,用 `bind` 命名参数,用 `{{ 表达式 }}` 连接文字、公式、图表和图解。文档作者无需编写 JavaScript 或 CSS。
6
+
7
+ 本地模式采用 HTML 风格标签,参数和表格数据直接写在正文中,LaTeX 公式可用于函数绘图。TypeScript 核心和 React 渲染器可独立集成。`0.6.1` 同时提供于 `latest` 与 `next` 渠道,公式展示改用 KaTeX,并随包提供数学字体,支持离线 HTML。语法修订继续为 `local-draft-2`,组块协议为 `component-protocol-2`。
8
+
9
+ ## 从这里开始
10
+
11
+ - [文档导航](docs/README.md):按入门、参考、集成、兼容、开发维护与发布记录查阅。
12
+ - [新用户入门指南](docs/guides/local-guide-ch.md):从 Markdown 过渡到交互文档,含完整练习与错误速查。
13
+ - [本地交互语法规范](docs/reference/local-interaction-syntax-ch.md) · [功能演示与示例](examples/local/README.md):48 个标签名、标签、就地参数与 LaTeX 绘图。
14
+ - [本地模式集成](docs/integration/local-integration-ch.md):`compileLocal`、状态运行时、React 嵌入、URL 策略与样式作用域。
15
+ - [HTML 部分兼容](docs/reference/html-compatibility-ch.md):P0 HTML 与下个发行版针对作者 CSS、JavaScript 和扩展 HTML 的暂时性分流政策。
16
+ - [可分享文档与静态导出](docs/integration/shareable-export-ch.md):单文件交互 HTML、静态输出、版本化状态文件、图片资源、CLI 与独立浏览器 API。
17
+ - [主题协议](docs/reference/theme-protocol-ch.md):文档主题选择、自定义 CSS 与深浅模式。
18
+ - [作者工具](docs/integration/author-tools-ch.md):源码高亮、补全、绑定定位、重命名、格式化与命令行检查。
19
+ - [React 源码编辑器](docs/integration/editor-ch.md):受控编辑器、属性、ref 句柄、诊断、语言、主题与历史。
20
+ - [独立接入示例](examples/integration/README.md):可复制到仓库外运行的 Node 核心和 React 页面。
21
+ - [版本与兼容性](docs/compatibility/compatibility-ch.md):0.x 规则、迁移、诊断契约和平台范围。
22
+ - [组块协议](docs/development/component-protocol-ch.md) · [组块开发指南](docs/development/component-development-ch.md):新增组件的声明、行为契约和兼容性验收。
23
+ - [0.6.1 发布说明](docs/releases/release-0.6.1-ch.md):KaTeX 公式排版、内嵌字体与离线公式。
24
+ - [0.5.3 发布说明](docs/releases/release-0.5.3-ch.md):宿主集成补丁与作者工具。
25
+ - [0.5.1 发布说明](docs/releases/release-0.5.1-ch.md):编辑器视图与主题,以及 HTML 兼容。
26
+ - [0.5.0 发布说明](docs/releases/release-0.5.0-ch.md):编辑器入口与文档渲染修复。
27
+ - [0.4.1 发布说明](docs/releases/release-0.4.1-ch.md):界面与交互修复,兼容 0.4.0。
28
+ - [0.4.0 发布与迁移](docs/releases/release-0.4.0-ch.md):本 minor 系列包含的能力,以及从 `0.3.1` / `local-draft-1` 升级的方法。
29
+
30
+ ## 写一份文档
31
+
32
+ ```markdown
33
+ <panel title="费用估算">
34
+ <slider bind="people" label="人数" initial="2" min="1" max="20">
35
+ <toggle bind="annual" label="年度付款">
36
+ </panel>
37
+
38
+ 每月费用:**{{ people * (annual ? 80 : 100) }} 元**。
39
+ ```
40
+
41
+ 输入立即更新结果,面板自带“恢复默认”。独立使用的计数器只需一行 `<counter label="人数">`。
42
+
43
+ `0.4.0` 新增 `local-draft-2`、命名计算、校验、集合、主题和离线 HTML 导出;旧版 `0.3.1` 使用 `local-draft-1`。见[0.4.0 发布与迁移](docs/releases/release-0.4.0-ch.md)。
44
+
45
+ ## 安装
46
+
47
+ 需要 Node.js 22.12 或更新版本,包提供 ESM 入口:
48
+
49
+ ```sh
50
+ npm install reactive-md
51
+ ```
52
+
53
+ `latest` 与 `next` 当前都指向 `0.6.1`:
54
+
55
+ ```sh
56
+ npm install reactive-md
57
+ # 或固定版本
58
+ npm install reactive-md@0.6.1
59
+ ```
60
+
61
+ 本版本说明见[0.6.1 发布说明](docs/releases/release-0.6.1-ch.md);从 `0.3.1` / `local-draft-1` 升级前请阅读[迁移说明](docs/releases/release-0.4.0-ch.md)。
62
+
63
+ `reactive-md` 入口提供本地编译器、表达式和运行时,`reactive-md/react` 提供 React 渲染器。组件样式通过 `reactive-md/styles.css` 引入。`reactive-md/editor` 提供源码编辑器,并使用独立样式 `reactive-md/editor/styles.css`。现有渲染器和样式导入在 0.6.1 中保持不变。
64
+
65
+ React 入口需要 React 19:
66
+
67
+ ```sh
68
+ npm install react@19 react-dom@19
69
+ ```
70
+
71
+ ```tsx
72
+ import { LocalReactiveDocument } from 'reactive-md/react';
73
+ import 'reactive-md/styles.css';
74
+
75
+ export function Article({ source }: { source: string }) {
76
+ return <LocalReactiveDocument source={source} />;
77
+ }
78
+ ```
79
+
80
+ `reactive-md` 核心入口不依赖 React。完整的编译与运行时 API、宿主 URL 策略、生命周期和样式覆盖见[本地模式集成](docs/integration/local-integration-ch.md)。
81
+
82
+ ## 用 React 编辑源码
83
+
84
+ 0.5.x 预览版在 `reactive-md/editor` 提供可复用的源码编辑器,样式位于 `reactive-md/editor/styles.css`。组件是受控的,需要 React 19:
85
+
86
+ ```tsx
87
+ import { useState } from 'react';
88
+ import { ReactiveMarkdownEditor } from 'reactive-md/editor';
89
+ import 'reactive-md/editor/styles.css';
90
+
91
+ export function Editor() {
92
+ const [source, setSource] = useState('# 笔记');
93
+ return <ReactiveMarkdownEditor value={source} onChange={setSource} />;
94
+ }
95
+ ```
96
+
97
+ 编辑器处理高亮、格式与插入工具、补全、绑定工具、撤销重做及行号。它不编译、不渲染预览;源码由应用保存,并用 `reactive-md/react` 渲染。属性、ref 句柄、诊断、主题、语言和历史规则见 [React 源码编辑器](docs/integration/editor-ch.md)。
98
+
99
+ 0.x 次版本可能包含破坏性变更。升级前阅读[变更记录](CHANGELOG-ch.md)与[兼容规则](docs/compatibility/compatibility-ch.md),并保存原始 `.reactive.md` 源码。
100
+
101
+ ## 分享文档
102
+
103
+ 构建读者可以离线打开的单个 HTML 文件,或不含脚本的静态快照:
104
+
105
+ ```sh
106
+ npm run build
107
+ npx reactive-md build examples/local/counter.reactive.md -o counter.html
108
+ npx reactive-md build examples/local/counter.reactive.md -o counter-static.html --mode static
109
+ ```
110
+
111
+ 交互文件内嵌原始源码、React 19、运行时、样式以及经过校验的本地图片。它先渲染静态首屏,因此禁用 JavaScript 时仍可阅读。使用 `--state-file doc.state.json` 导出已保存的 `reactive-md-state/v1` 基线;省略时使用作者初值,并把它作为读者的重置基线。Demo 导出对话框可以把当前预览参数保存成此类状态文件。
112
+
113
+ 图片上限、CSP/安全、打印、退出码、`ReactiveMD.mount`/`mountAll` 与 `<reactive-md-doc>` 见[可分享文档与静态导出](docs/integration/shareable-export-ch.md)。CI 在 Chromium 上运行完整浏览器门禁,并使用 Firefox 与 WebKit 运行核心工作流;本机浏览器检查使用 Microsoft Edge。Firefox 与 WebKit 的完整交互套件和通用 SSR 水合仍未验证。
114
+
115
+ ## 体验 Demo
116
+
117
+ ```sh
118
+ npm ci
119
+ npm run dev
120
+ ```
121
+
122
+ 该命令先构建语言包,再启动独立的 `demo/` 应用,地址为 `http://127.0.0.1:5173`。`/embed.html` 展示嵌入方式。页面顶部的语言按钮可以在中文和英文之间切换,选择会保存在浏览器中。Demo 的页面、编辑器、演示服务、资产和浏览器检查均在 `demo/`,通过语言包的公开入口集成。
123
+
124
+ ## 仓库结构
125
+
126
+ ```text
127
+ src/ 本地语法编译、表达式、运行时和 React 渲染器
128
+ examples/ 可复制的本地交互示例,与 demo 应用无关
129
+ docs/ 本地语法规范、集成与发布文档
130
+ tests/ 语言与渲染器测试
131
+ demo/ 独立的 Playground 应用
132
+ ```
133
+
134
+ ## 文档
135
+
136
+ - [新用户入门指南](docs/guides/local-guide-ch.md)与[本地交互语法规范](docs/reference/local-interaction-syntax-ch.md)。
137
+ - [本地模式集成](docs/integration/local-integration-ch.md):核心与 React API、URL 策略、生命周期、样式和版本固定。
138
+ - [可分享文档与静态导出](docs/integration/shareable-export-ch.md):CLI build/lint、状态文件、本地图片内联、打印与独立浏览器运行时。
139
+ - [功能演示与示例](examples/local/README.md)与[独立接入示例](examples/integration/README.md)。
140
+ - [React 源码编辑器](docs/integration/editor-ch.md):编辑 `.reactive.md` 源码的受控组件,使用独立样式表。
141
+ - [版本与兼容性](docs/compatibility/compatibility-ch.md)、[0.6.1 发布说明](docs/releases/release-0.6.1-ch.md)与[0.5.1 发布说明](docs/releases/release-0.5.1-ch.md)。
142
+ - [0.4.0 发布与迁移](docs/releases/release-0.4.0-ch.md)。
143
+ - [组块协议](docs/development/component-protocol-ch.md)与[组块开发指南](docs/development/component-development-ch.md)。
144
+ - [性能说明](docs/development/performance-ch.md)与[发布清单](docs/development/releasing-ch.md)。
145
+
146
+ 更多开发与测试命令见[贡献指南](CONTRIBUTING-ch.md)。
147
+
148
+ ## 贡献与安全
149
+
150
+ - [贡献指南](CONTRIBUTING-ch.md):环境、检查命令和改动要求。
151
+ - [安全策略](SECURITY-ch.md):威胁边界、资源上限、宿主责任和漏洞报告渠道。
152
+ - [变更记录](CHANGELOG-ch.md)。
153
+ - [发布清单](docs/development/releasing-ch.md):验证门禁、notice、tarball 和人工发布流程。
154
+
155
+ ## 许可证
156
+
157
+ [MIT](LICENSE)