reactive-md 0.5.2 → 0.6.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.
Files changed (110) hide show
  1. package/CHANGELOG-ch.md +47 -15
  2. package/CHANGELOG.md +47 -15
  3. package/CONTRIBUTING-ch.md +10 -5
  4. package/CONTRIBUTING.md +10 -5
  5. package/README-ch.md +38 -36
  6. package/README-en.md +45 -42
  7. package/README.md +45 -42
  8. package/SECURITY-ch.md +1 -1
  9. package/SECURITY.md +1 -1
  10. package/THIRD_PARTY_NOTICES.md +481 -1
  11. package/cli/build.mjs +1 -1
  12. package/cli/package.mjs +1 -0
  13. package/dist-library/authoring-DSC0VsNK.js +842 -0
  14. package/dist-library/{runtime-UiQPz5ZV.js → compiler-CRD88BMt.js} +8944 -5847
  15. package/dist-library/react-Dk94rcOp.js +59658 -0
  16. package/dist-library/reactive-md-authoring.js +1514 -0
  17. package/dist-library/reactive-md-editor.js +589 -570
  18. package/dist-library/reactive-md-print.css +284 -0
  19. package/dist-library/reactive-md-react-unstyled.js +1 -0
  20. package/dist-library/reactive-md-react.js +1 -13208
  21. package/dist-library/reactive-md.css +1 -1
  22. package/dist-library/reactive-md.js +308 -1126
  23. package/dist-library/runtime-D8KbnCd0.js +498 -0
  24. package/dist-library/types/authoring/index.d.ts +24 -0
  25. package/dist-library/types/editor/command-types.d.ts +10 -0
  26. package/dist-library/types/editor/editor-commands.d.ts +2 -2
  27. package/dist-library/types/editor/editor-i18n.d.ts +1 -1
  28. package/dist-library/types/editor/native-components.d.ts +1 -1
  29. package/dist-library/types/editor/source-authoring.d.ts +5 -3
  30. package/dist-library/types/editor/types.d.ts +7 -10
  31. package/dist-library/types/local/LocalDocumentView.d.ts +4 -2
  32. package/dist-library/types/local/authoring.d.ts +9 -5
  33. package/dist-library/types/local/code-block.d.ts +3 -1
  34. package/dist-library/types/local/code-languages.d.ts +7 -0
  35. package/dist-library/types/local/compiled-data.d.ts +6 -0
  36. package/dist-library/types/local/compiler.d.ts +1 -0
  37. package/dist-library/types/local/diagnostics.d.ts +71 -0
  38. package/dist-library/types/local/diagram-layout.d.ts +69 -0
  39. package/dist-library/types/local/html-names.d.ts +6 -0
  40. package/dist-library/types/local/html-table.d.ts +25 -0
  41. package/dist-library/types/local/index.d.ts +1 -0
  42. package/dist-library/types/local/math-display.d.ts +73 -0
  43. package/dist-library/types/local/math-view.d.ts +2 -0
  44. package/dist-library/types/local/options.d.ts +3 -1
  45. package/dist-library/types/local/table-surface.d.ts +10 -0
  46. package/dist-library/types/local/types.d.ts +12 -0
  47. package/dist-library/types/local/visuals.d.ts +9 -0
  48. package/dist-library/types/local/worker.d.ts +3 -2
  49. package/dist-library/types/react/index.d.ts +1 -1
  50. package/dist-standalone/reactive-md-standalone.css +1 -1
  51. package/dist-standalone/reactive-md-standalone.js +79 -51
  52. package/docs/README.md +84 -0
  53. package/docs/{compatibility-ch.md → compatibility/compatibility-ch.md} +28 -18
  54. package/docs/{compatibility-en.md → compatibility/compatibility-en.md} +28 -18
  55. package/docs/{source-versioning-ch.md → compatibility/source-versioning-ch.md} +2 -2
  56. package/docs/{source-versioning-en.md → compatibility/source-versioning-en.md} +2 -2
  57. package/docs/{component-development-ch.md → development/component-development-ch.md} +7 -7
  58. package/docs/{component-development-en.md → development/component-development-en.md} +7 -7
  59. package/docs/{component-protocol-ch.md → development/component-protocol-ch.md} +17 -17
  60. package/docs/{component-protocol-en.md → development/component-protocol-en.md} +17 -17
  61. package/docs/{performance-ch.md → development/performance-ch.md} +2 -2
  62. package/docs/{performance-en.md → development/performance-en.md} +2 -2
  63. package/docs/{releasing-ch.md → development/releasing-ch.md} +12 -12
  64. package/docs/{releasing-en.md → development/releasing-en.md} +12 -12
  65. package/docs/guides/local-guide-ch.md +513 -0
  66. package/docs/guides/local-guide-en.md +513 -0
  67. package/docs/{author-tools-ch.md → integration/author-tools-ch.md} +13 -7
  68. package/docs/{author-tools-en.md → integration/author-tools-en.md} +13 -7
  69. package/docs/{editor-ch.md → integration/editor-ch.md} +238 -235
  70. package/docs/{editor-en.md → integration/editor-en.md} +238 -235
  71. package/docs/{local-integration-ch.md → integration/local-integration-ch.md} +410 -390
  72. package/docs/{local-integration-en.md → integration/local-integration-en.md} +410 -390
  73. package/docs/{shareable-export-ch.md → integration/shareable-export-ch.md} +16 -4
  74. package/docs/{shareable-export-en.md → integration/shareable-export-en.md} +16 -4
  75. package/docs/{computations-formatting-ch.md → reference/computations-formatting-ch.md} +2 -2
  76. package/docs/{computations-formatting-en.md → reference/computations-formatting-en.md} +2 -2
  77. package/docs/{constraints-collections-ch.md → reference/constraints-collections-ch.md} +2 -2
  78. package/docs/{constraints-collections-en.md → reference/constraints-collections-en.md} +2 -2
  79. package/docs/{diagnostics-counting-ch.md → reference/diagnostics-counting-ch.md} +22 -2
  80. package/docs/{diagnostics-counting-en.md → reference/diagnostics-counting-en.md} +22 -2
  81. package/docs/{html-compatibility-ch.md → reference/html-compatibility-ch.md} +42 -4
  82. package/docs/{html-compatibility-en.md → reference/html-compatibility-en.md} +42 -4
  83. package/docs/{local-components-v2-ch.md → reference/local-components-v2-ch.md} +2 -2
  84. package/docs/{local-components-v2-en.md → reference/local-components-v2-en.md} +2 -2
  85. package/docs/{local-interaction-syntax-ch.md → reference/local-interaction-syntax-ch.md} +26 -7
  86. package/docs/{local-interaction-syntax-en.md → reference/local-interaction-syntax-en.md} +26 -7
  87. package/docs/{theme-protocol-ch.md → reference/theme-protocol-ch.md} +1 -1
  88. package/docs/{theme-protocol-en.md → reference/theme-protocol-en.md} +1 -1
  89. package/docs/{release-0.4.0-ch.md → releases/release-0.4.0-ch.md} +6 -6
  90. package/docs/{release-0.4.0-en.md → releases/release-0.4.0-en.md} +6 -6
  91. package/docs/{release-0.4.1-ch.md → releases/release-0.4.1-ch.md} +2 -2
  92. package/docs/{release-0.4.1-en.md → releases/release-0.4.1-en.md} +2 -2
  93. package/docs/{release-0.5.0-ch.md → releases/release-0.5.0-ch.md} +4 -4
  94. package/docs/{release-0.5.0-en.md → releases/release-0.5.0-en.md} +4 -4
  95. package/docs/{release-0.5.1-ch.md → releases/release-0.5.1-ch.md} +4 -4
  96. package/docs/{release-0.5.1-en.md → releases/release-0.5.1-en.md} +4 -4
  97. package/docs/{release-0.5.2-ch.md → releases/release-0.5.2-ch.md} +3 -3
  98. package/docs/{release-0.5.2-en.md → releases/release-0.5.2-en.md} +3 -3
  99. package/docs/releases/release-0.5.3-ch.md +25 -0
  100. package/docs/releases/release-0.5.3-en.md +25 -0
  101. package/docs/releases/release-0.6.0-ch.md +57 -0
  102. package/docs/releases/release-0.6.0-en.md +57 -0
  103. package/examples/conformance/README.md +4 -4
  104. package/examples/integration/README.md +10 -8
  105. package/examples/integration/worker/package.json +1 -1
  106. package/examples/local/README.md +5 -5
  107. package/examples/local/html-compat.reactive.md +19 -0
  108. package/package.json +20 -3
  109. package/docs/local-guide-ch.md +0 -967
  110. package/docs/local-guide-en.md +0 -967
@@ -1,10 +1,10 @@
1
1
  # 可分享文档与静态导出
2
2
 
3
- 本文说明 `local-draft-2` 新增的单文件 HTML 导出能力。编译与运行时接口见[本地模式集成](local-integration-ch.md),语法见[交互语法规范](local-interaction-syntax-ch.md),修订声明与迁移见[源码修订与迁移](source-versioning-ch.md),升级说明见[0.4.0 发布与迁移](release-0.4.0-ch.md)。
3
+ 本文说明 `local-draft-2` 新增的单文件 HTML 导出能力。编译与运行时接口见[本地模式集成](local-integration-ch.md),语法见[交互语法规范](../reference/local-interaction-syntax-ch.md),修订声明与迁移见[源码修订与迁移](../compatibility/source-versioning-ch.md),升级说明见[0.4.0 发布与迁移](../releases/release-0.4.0-ch.md)。
4
4
 
5
5
  ## 两种产物
6
6
 
7
- 默认 ReactiveMD 文档遵循下述导出规则。原生 HTML 文档的交互导出保留 `compileOptions` 和整篇 HTML 路径,静态导出禁用作者 JavaScript;这类文档没有 ReactiveMD 参数。编译开关、隔离和暂时性分流政策见 [HTML 部分兼容](html-compatibility-ch.md)。
7
+ 默认 ReactiveMD 文档遵循下述导出规则。原生 HTML 文档的交互导出保留 `compileOptions` 和整篇 HTML 路径,静态导出禁用作者 JavaScript;这类文档没有 ReactiveMD 参数。编译开关、隔离和暂时性分流政策见 [HTML 部分兼容](../reference/html-compatibility-ch.md)。
8
8
 
9
9
  **交互式 HTML** 是一个自包含的 `.html` 文件。它内嵌原始源码、独立浏览器运行时、React 19、样式表和打印样式。读者通过 `file://` 打开即可交互,不需要 Node.js、React、reactive-md 包或网络连接。
10
10
 
@@ -62,7 +62,7 @@ reactive-md migrate old.reactive.md --check --json
62
62
 
63
63
  默认把迁移后的源码写到标准输出。`-o` 使用独占创建,拒绝任何已存在的路径,包括输入文件本身。`--check` 从不写入。`--json` 只输出结构化报告。`--accept-semantic-changes` 允许文本控件长度语义变化并报告警告;`--locale en|zh` 选择显示语言。
64
64
 
65
- 迁移被阻止时退出 `1`,成功时退出 `0`。`--check` 在需要迁移或被阻止时退出 `1`,源码已是当前版本时退出 `0`。用法和 I/O 错误退出 `2`。命令不就地覆盖,也不提供批量或 `--write` 模式。检查项、保留字节和状态摘要影响见[源码修订与迁移](source-versioning-ch.md)。
65
+ 迁移被阻止时退出 `1`,成功时退出 `0`。`--check` 在需要迁移或被阻止时退出 `1`,源码已是当前版本时退出 `0`。用法和 I/O 错误退出 `2`。命令不就地覆盖,也不提供批量或 `--write` 模式。检查项、保留字节和状态摘要影响见[源码修订与迁移](../compatibility/source-versioning-ch.md)。
66
66
 
67
67
  ## 起始参数与状态文件
68
68
 
@@ -106,6 +106,18 @@ Demo 导出对话框可以把当前预览参数下载为状态文件,供后续
106
106
 
107
107
  ## 图片
108
108
 
109
+ ### 浏览器
110
+
111
+ 在 Demo 的**文档图片**面板中选择文件,或把图片粘贴到源码编辑器。通过校验的图片会在选区处插入 Markdown 引用,并加入资源清单。清单显示引用路径、格式、大小及引用状态,支持替换和移除。批量导入中有文件不合格时,源码和清单均保持原状。
112
+
113
+ 支持 PNG、JPEG、GIF、WebP,检查文件内容、声明 MIME 类型和浏览器解码结果。单张上限 8 MiB,合计 24 MiB,最多 64 项,不支持 SVG。资源按当前文档和语言保存在 IndexedDB;出现存储警告时,资源仅在当前页面会话内可用。
114
+
115
+ 导出弹窗会列出缺失图片,可逐项选择本地文件,也可为远程 URL 指定本地替代文件。浏览器不会自动抓取远程图片。补齐全部引用后才能导出 HTML;交互式和静态导出都会内嵌所引用的文件,未引用资源不会打包。Markdown 和状态文件下载均不包含图片文件。
116
+
117
+ 这些浏览器资源操作适用于 ReactiveMD 路由,包括 P0 `<img>` 元素。原生 HTML 路由沿用独立的图片策略。
118
+
119
+ ### CLI
120
+
109
121
  离线导出默认使用 `--assets inline`:
110
122
 
111
123
  - 只读取文档目录内或显式 `--asset-root` 内的相对路径。
@@ -184,7 +196,7 @@ IIFE 会注册一个 Light DOM 自定义元素。简单选项通过属性传递
184
196
  - 核心入口仍不加载 React。
185
197
  - 状态导出与导入只使用公开绑定名和经过校验的值。
186
198
  - 读者修改不会持久化到导出文件。
187
- - Demo 预览仍按默认策略阻止图片;Demo 没有资源根,因此文档包含图片时会禁用 HTML 导出。含图文档请使用 CLI。
199
+ - Demo 会预览并导出文档资源清单中已提供的图片。引用缺失时,选择对应文件后才能导出 HTML。
188
200
  - 导出格式版本为 `reactive-md-html/v1`,可从生成的 meta 标签检查。
189
201
 
190
202
  ## 产物体积基线
@@ -1,10 +1,10 @@
1
1
  # Shareable documents and static export
2
2
 
3
- This guide covers the single-file HTML exporter introduced with `local-draft-2`. It complements [Local mode integration](local-integration-en.md), the [syntax reference](local-interaction-syntax-en.md), [Source revisions and migration](source-versioning-en.md) and the [0.4.0 release notes](release-0.4.0-en.md).
3
+ This guide covers the single-file HTML exporter introduced with `local-draft-2`. It complements [Local mode integration](local-integration-en.md), the [syntax reference](../reference/local-interaction-syntax-en.md), [Source revisions and migration](../compatibility/source-versioning-en.md) and the [0.4.0 release notes](../releases/release-0.4.0-en.md).
4
4
 
5
5
  ## Output modes
6
6
 
7
- The rules below describe default ReactiveMD documents. Native HTML interactive export preserves `compileOptions` and whole-document HTML routing; static export disables author JavaScript. These documents have no ReactiveMD parameters. See [HTML compatibility](html-compatibility-en.md) for capability flags, isolation and the temporary routing policy.
7
+ The rules below describe default ReactiveMD documents. Native HTML interactive export preserves `compileOptions` and whole-document HTML routing; static export disables author JavaScript. These documents have no ReactiveMD parameters. See [HTML compatibility](../reference/html-compatibility-en.md) for capability flags, isolation and the temporary routing policy.
8
8
 
9
9
  **Interactive HTML** is one self-contained `.html` file. It embeds the original source, the standalone browser runtime, React 19, the current stylesheet and print styles. Readers can open it through `file://` without Node.js, React, the reactive-md package or network access.
10
10
 
@@ -64,7 +64,7 @@ reactive-md migrate old.reactive.md --check --json
64
64
 
65
65
  By default it prints the migrated source to standard output. `-o` creates a new file with exclusive creation and refuses any existing path, including the input. `--check` never writes. `--json` prints a structured report and nothing else. `--accept-semantic-changes` allows the text-control length change and reports warnings; `--locale en|zh` selects the display language.
66
66
 
67
- A migration exits `1` when blocked and `0` on success. `--check` exits `1` when changes are needed or blocked, and `0` when the source is current. Usage and I/O errors exit `2`. The command does not overwrite in place and has no batch or `--write` mode. See [Source revisions and migration](source-versioning-en.md) for the checks, preserved bytes and state-digest consequences.
67
+ A migration exits `1` when blocked and `0` on success. `--check` exits `1` when changes are needed or blocked, and `0` when the source is current. Usage and I/O errors exit `2`. The command does not overwrite in place and has no batch or `--write` mode. See [Source revisions and migration](../compatibility/source-versioning-en.md) for the checks, preserved bytes and state-digest consequences.
68
68
 
69
69
  ## Starting values and state files
70
70
 
@@ -108,6 +108,18 @@ The demo's export dialog can download the current preview parameters as a state
108
108
 
109
109
  ## Images
110
110
 
111
+ ### Browser
112
+
113
+ Use **Document images** in the demo to select files, or paste an image into the source editor. Accepted files create a Markdown reference at the selection and appear in the resource list. The list shows each source URL, format, size and whether the document references it; files can be replaced or removed. Imports are checked as a batch: an invalid file leaves the source and manifest unchanged.
114
+
115
+ PNG, JPEG, GIF and WebP are checked by content, declared MIME type and browser decoding. Limits are 8 MiB per image, 24 MiB total and 64 resources. SVG is unsupported. Resources are saved in IndexedDB for the current document and language; a storage warning means they remain available only for this page session.
116
+
117
+ The export dialog lists missing image references and lets you choose a local file for each one, including a local replacement for a remote URL. It never fetches remote images. All references must be supplied before HTML export. Both interactive and static exports inline the referenced files; unused resources stay out of the export. Markdown and state downloads contain no image files.
118
+
119
+ These browser resource controls apply to the ReactiveMD route, including P0 `<img>` elements. Native HTML routing keeps its separate image policy.
120
+
121
+ ### CLI
122
+
111
123
  Offline export defaults to `--assets inline`:
112
124
 
113
125
  - Only relative paths that resolve inside the document directory, or an explicit `--asset-root`, are read.
@@ -186,7 +198,7 @@ The element uses Light DOM so the existing document CSS, heading anchors and pri
186
198
  - The core entry remains React-free.
187
199
  - State export and import use only public binding names and validated values.
188
200
  - Exported HTML does not persist a reader's changes.
189
- - The demo preview still blocks images unless a host policy is supplied; the demo export dialog disables HTML export when a document contains images because it has no asset root. Use the CLI for image-bearing documents.
201
+ - The demo previews and exports images supplied through its document resource list. Missing references block HTML export until files are selected.
190
202
  - The export format version is `reactive-md-html/v1`; inspect it in the generated meta tags.
191
203
 
192
204
  ## Bundle baseline
@@ -1,6 +1,6 @@
1
1
  # 复用计算与格式化数值
2
2
 
3
- 这些能力属于使用 `local-draft-2` 的 `0.4.0`。完整语法见[语法规范](local-interaction-syntax-ch.md),宿主接口见[集成说明](local-integration-ch.md),可运行文档见[账单示例](../examples/local/recipes/invoice-zh.reactive.md)。
3
+ 这些能力属于使用 `local-draft-2` 的 `0.4.0`。完整语法见[语法规范](local-interaction-syntax-ch.md),宿主接口见[集成说明](../integration/local-integration-ch.md),可运行文档见[账单示例](../../examples/local/recipes/invoice-zh.reactive.md)。
4
4
 
5
5
  ## 命名值
6
6
 
@@ -84,4 +84,4 @@ null 格式化为空字符串,其余参数严格检查类型,不把字符串
84
84
 
85
85
  ## 兼容性
86
86
 
87
- 现有表达式和 `round(x)` 保持原有行为。新增函数名称成为本版本的保留标识符;升级前应重命名使用这些名称的旧绑定,并同步修改引用。[变更记录](../CHANGELOG-ch.md)记载了此次扩展。
87
+ 现有表达式和 `round(x)` 保持原有行为。新增函数名称成为本版本的保留标识符;升级前应重命名使用这些名称的旧绑定,并同步修改引用。[变更记录](../../CHANGELOG-ch.md)记载了此次扩展。
@@ -1,6 +1,6 @@
1
1
  # Reusing calculations and formatting values
2
2
 
3
- These additions belong to `0.4.0`, which uses `local-draft-2`. See the [syntax specification](local-interaction-syntax-en.md), [integration API](local-integration-en.md) and [working example](../examples/local/recipes/invoice.reactive.md).
3
+ These additions belong to `0.4.0`, which uses `local-draft-2`. See the [syntax specification](local-interaction-syntax-en.md), [integration API](../integration/local-integration-en.md) and [working example](../../examples/local/recipes/invoice.reactive.md).
4
4
 
5
5
  ## Named values
6
6
 
@@ -84,4 +84,4 @@ Declaration diagnostics use `local.computation.*`: `placement`, `name`, `reserve
84
84
 
85
85
  ## Compatibility
86
86
 
87
- Existing expressions and `round(x)` keep their behavior. The new function names are reserved identifiers in this release. Rename any pre-existing bindings with these names and update their references before upgrading. The [changelog](../CHANGELOG.md) lists this addition.
87
+ Existing expressions and `round(x)` keep their behavior. The new function names are reserved identifiers in this release. Rename any pre-existing bindings with these names and update their references before upgrading. The [changelog](../../CHANGELOG.md) lists this addition.
@@ -1,6 +1,6 @@
1
1
  # 条件、校验与本地集合
2
2
 
3
- 这些能力扩展使用 `local-draft-2` 的 `0.4.0`。[工作坊示例](../examples/local/recipes/workshop-zh.reactive.md)把人数预算、日期区间和已选主题表格放在同一份文档里,[命名计算](computations-formatting-ch.md)保存其中间结果。
3
+ 这些能力扩展使用 `local-draft-2` 的 `0.4.0`。[工作坊示例](../../examples/local/recipes/workshop-zh.reactive.md)把人数预算、日期区间和已选主题表格放在同一份文档里,[命名计算](computations-formatting-ch.md)保存其中间结果。
4
4
 
5
5
  ## 跨字段校验
6
6
 
@@ -79,6 +79,6 @@
79
79
 
80
80
  ## 集成与兼容性
81
81
 
82
- `LocalDocument.validations` 保存可序列化的 `LocalValidation` 元数据,宿主可随时调用 `runtime.validate()`,调用不会修改状态。编译后的文档仍可用 `structuredClone` 传递给 Worker。对象生命周期和持久化规则见[集成说明](local-integration-ch.md)。
82
+ `LocalDocument.validations` 保存可序列化的 `LocalValidation` 元数据,宿主可随时调用 `runtime.validate()`,调用不会修改状态。编译后的文档仍可用 `structuredClone` 传递给 Worker。对象生命周期和持久化规则见[集成说明](../integration/local-integration-ch.md)。
83
83
 
84
84
  新增聚合函数名 `sum`、`average`、`minOf`、`maxOf` 成为保留字,升级前需重命名冲突绑定及其引用。对 `LocalValueKind` 做穷举检查的宿主应加入 `number-array`;可写多选与清单控件仍只接受字符串。预览版发布在 `next` 渠道。
@@ -1,6 +1,6 @@
1
1
  # Constraints, conditional tones and local collections
2
2
 
3
- These additions extend `0.4.0`, which uses `local-draft-2`. The [workshop example](../examples/local/recipes/workshop.reactive.md) combines a participant budget, a date interval and a selected-subject table. [Named calculations](computations-formatting-en.md) hold its intermediate results.
3
+ These additions extend `0.4.0`, which uses `local-draft-2`. The [workshop example](../../examples/local/recipes/workshop.reactive.md) combines a participant budget, a date interval and a selected-subject table. [Named calculations](computations-formatting-en.md) hold its intermediate results.
4
4
 
5
5
  ## Cross-field validation
6
6
 
@@ -79,6 +79,6 @@ An empty array displays the headers and an empty-state message. Failure of the r
79
79
 
80
80
  ## Integration and compatibility
81
81
 
82
- `LocalDocument.validations` contains serializable `LocalValidation` metadata. Hosts can call `runtime.validate()` at any time without changing state. The compiled document remains transferable to a Worker with `structuredClone`. The [core integration guide](local-integration-en.md) describes its lifetime and persistence rules.
82
+ `LocalDocument.validations` contains serializable `LocalValidation` metadata. Hosts can call `runtime.validate()` at any time without changing state. The compiled document remains transferable to a Worker with `structuredClone`. The [core integration guide](../integration/local-integration-en.md) describes its lifetime and persistence rules.
83
83
 
84
84
  The aggregate names `sum`, `average`, `minOf` and `maxOf` become reserved identifiers. Rename conflicting bindings and their references before using this release. Hosts with exhaustive `LocalValueKind` checks should add `number-array`; writable multi-select and checklist controls still require strings. The preview is published on the `next` channel.
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](diagnostics-counting-en.md)
4
4
 
5
- 本页定义 0.4.x 的诊断契约、字符长度单位与资源预算作用域。
5
+ 本页定义诊断契约、字符长度单位与资源预算作用域。
6
6
 
7
7
  ## 诊断契约
8
8
 
@@ -23,6 +23,26 @@ for (const diagnostic of result.diagnostics) {
23
23
 
24
24
  诊断数量达到上限时,新警告可以被省略;新的错误优先替换已有警告。编译错误使 `ok` 为 `false`。运行时写入被拒绝时,已提交状态与 revision 保持不变。
25
25
 
26
+ ### 原生 HTML 安全回退
27
+
28
+ | 情况 | 机器契约 | 宿主处理 |
29
+ | --- | --- | --- |
30
+ | 原生 HTML 已转换为惰性源码 | `code: 'local.html.fallback'`,`severity: 'warning'` | 对应 HTML 已成为纯文本,可以单独放行此警告 |
31
+ | 未知 ReactiveMD 组件,例如 `<slidr />` | `code: 'local.component.unknown'` | 按宿主的组件策略报告或拒绝 |
32
+ | 致命编译失败 | `result.ok === false`,并有 `error` 诊断 | 拒绝此次编译;界面显示源码不改变失败结果 |
33
+
34
+ 专用回退码覆盖两条编译路径中不支持的原生标签、属性、不完整片段和原生表格。它只说明对应 HTML 已回退,同一文档仍可能有其他问题。移除原生 HTML 中未获授权的脚本等能力裁剪继续使用 `local.html.capability`,不属于源码回退。旧诊断码仍保留注册;宿主应按专用码设置放行策略:
35
+
36
+ ```ts
37
+ const result = compileLocal(source);
38
+ if (!result.ok) throw new Error('编译失败');
39
+ const unhandled = result.diagnostics.filter(d => d.code !== 'local.html.fallback');
40
+ if (unhandled.length) throw new Error('文档需要检查');
41
+ // 可以按宿主的 HTML 策略渲染 result.document。
42
+ ```
43
+
44
+ 不同回退原因可以保留不同消息和模板键,分类使用 `code` 与 `severity`。渲染行为见 [HTML 原文回退](html-compatibility-ch.md#原文回退)。
45
+
26
46
  ## 文本长度
27
47
 
28
48
  | 用途 | 计数单位 |
@@ -81,4 +101,4 @@ for (const diagnostic of result.diagnostics) {
81
101
 
82
102
  ## 验收
83
103
 
84
- 回归用例覆盖 Unicode 长度、UTF-16 定位、CRLF、预算临界值、双语诊断字段一致性,以及警告占满时的错误保留。编辑器和 CLI 的集成检查使用真实诊断对象;业务逻辑不依赖完整消息文本。版本兼容说明见[版本与兼容性](compatibility-ch.md),命令行使用见[作者工具](author-tools-ch.md)。
104
+ 回归用例覆盖 Unicode 长度、UTF-16 定位、CRLF、预算临界值、双语诊断字段一致性,以及警告占满时的错误保留。编辑器和 CLI 的集成检查使用真实诊断对象;业务逻辑不依赖完整消息文本。版本兼容说明见[版本与兼容性](../compatibility/compatibility-ch.md),命令行使用见[作者工具](../integration/author-tools-ch.md)。
@@ -2,7 +2,7 @@
2
2
 
3
3
  [中文](diagnostics-counting-ch.md)
4
4
 
5
- This page defines the 0.4.x diagnostics contract, text-length units and resource-budget scopes.
5
+ This page defines the diagnostics contract, text-length units and resource-budget scopes.
6
6
 
7
7
  ## Diagnostics contract
8
8
 
@@ -23,6 +23,26 @@ Ranges are zero-based UTF-16 indexes with half-open intervals `[start, end)`. Li
23
23
 
24
24
  When the diagnostic limit is reached, new warnings may be omitted; a new error takes priority over an existing warning. Compile errors make `ok` false. Rejected runtime writes preserve committed state and revision.
25
25
 
26
+ ### Safe native HTML fallback
27
+
28
+ | Outcome | Machine contract | Host action |
29
+ | --- | --- | --- |
30
+ | Native HTML converted to inert source | `code: 'local.html.fallback'`, `severity: 'warning'` | The affected HTML is already literal text; this warning can be allowed explicitly |
31
+ | Unknown ReactiveMD component, such as `<slidr />` | `code: 'local.component.unknown'` | Report or reject according to the host's component policy |
32
+ | Fatal compilation failure | `result.ok === false`, with an `error` diagnostic | Reject the compilation; rendering source text does not change this outcome |
33
+
34
+ The fallback code covers unsupported native tags, attributes, malformed fragments and native tables in both compilation routes. It does not mean the entire document has no other problems. Capability stripping, such as removing disabled scripts from native HTML, retains `local.html.capability`; it is not source fallback. Existing codes remain registered, but hosts should use the dedicated code for this allowance:
35
+
36
+ ```ts
37
+ const result = compileLocal(source);
38
+ if (!result.ok) throw new Error('Compilation failed');
39
+ const unhandled = result.diagnostics.filter(d => d.code !== 'local.html.fallback');
40
+ if (unhandled.length) throw new Error('Document needs review');
41
+ // result.document is ready for rendering under the host's HTML policy.
42
+ ```
43
+
44
+ Messages and template keys describe the cause and may differ across fallback cases. Use `code` and `severity` for classification. See [HTML source fallback](html-compatibility-en.md#source-fallback) for rendering behavior.
45
+
26
46
  ## Text length
27
47
 
28
48
  | Purpose | Unit |
@@ -81,4 +101,4 @@ Expression compilation caches hold at most 500 entries; formula compilation cach
81
101
 
82
102
  ## Validation
83
103
 
84
- Regression cases cover Unicode lengths, UTF-16 locations, CRLF, budget boundaries, equivalent machine fields across languages, and error retention after warnings fill the diagnostic limit. Editor and CLI checks use real diagnostic objects. Business logic does not depend on complete message text. See [Versions and compatibility](compatibility-en.md) and [Author tools](author-tools-en.md).
104
+ Regression cases cover Unicode lengths, UTF-16 locations, CRLF, budget boundaries, equivalent machine fields across languages, and error retention after warnings fill the diagnostic limit. Editor and CLI checks use real diagnostic objects. Business logic does not depend on complete message text. See [Versions and compatibility](../compatibility/compatibility-en.md) and [Author tools](../integration/author-tools-en.md).
@@ -65,25 +65,63 @@ React 快捷组件通过 `compileOptions` 接收同样的设置:
65
65
  | 代码 | `code`、`pre`、`pre` 内的 `code` |
66
66
  | 列表 | `ul`、`ol`、`li`,含 `ol[start]` |
67
67
  | 链接与图片 | `a`、`img`,沿用默认路径的 URL 策略 |
68
+ | 原生表格 | `table`、`caption`、`colgroup`、`col`、`thead`、`tbody`、`tfoot`、`tr`、`th`、`td`,按正文结构与 ReactiveMD 表格区分 |
68
69
  | 其他写法 | HTML 注释、命名及数字字符引用、HTML 大小写和空元素写法 |
69
70
 
70
71
  容器中的正文继续解析 Markdown、公式、插值和 ReactiveMD 控件;`code`、`pre` 中的内容按字面显示。`details` 复用现有折叠组件的主题和交互,支持富文本标题、嵌套和 `open`,静态模式展开正文。HTML 布尔属性按存在与否判断,因此 `open="false"` 仍表示展开;现有 ReactiveMD 组件的布尔值规则保持不变。
71
72
 
72
- 可运行示例见 [HTML 与 ReactiveMD](../examples/local/html-compat.reactive.md)。
73
+ 可运行示例见 [HTML 与 ReactiveMD](../../examples/local/html-compat.reactive.md)。
74
+
75
+ `div`、`p` 和 `h1` 至 `h6` 支持静态 `align` 属性,取值为 `left`、`center`、`right` 或 `justify`,忽略大小写和首尾空白。例如:
76
+
77
+ ```html
78
+ <div align="center">你好</div>
79
+ <p align="right">右对齐的 **Markdown** 段落。</p>
80
+ ```
81
+
82
+ 对齐不需要开启 CSS 或扩展 HTML,容器内的 Markdown 和绑定继续生效;嵌套元素可以设置自己的对齐。原生 HTML 路径同样接受这些限定值。
73
83
 
74
84
  通用属性按允许列表接收,支持文档标识、标题、语言、方向和可访问性属性。默认模式中的作者 `style`、事件处理属性及不支持的标签保持惰性源码或产生定位诊断。图片仍需宿主明确允许后才加载。代码与不支持区域不执行脚本。
75
85
 
86
+ `a` 支持静态 `target`、`rel` 属性,例如 `<a href="https://example.com" target="_self" rel="nofollow">当前页面打开</a>`。显式 `target` 覆盖默认打开方式,`rel` 支持多个空白分隔的关系词。默认混排模式中,未指定属性的 HTTP(S) 链接仍使用 `_blank` 和 `noopener noreferrer`;相对链接仍在当前页面打开。`target="_blank"` 会保留作者关系词、合并 `noopener noreferrer` 并移除冲突的 `opener`。沙箱 HTML 路径也支持这两个属性,且继续限制 `_top`、`_parent` 导航及弹窗权限。
87
+
88
+ ## 两种表格写法
89
+
90
+ `<table>` 的正文是 Markdown 表格时,继续使用 ReactiveMD 表格组件,保留搜索、排序、分页和行选择。正文出现原生表格结构时,解析为 HTML 表格,无需开启扩展 HTML,也不切换整篇文档的模式:
91
+
92
+ ```html
93
+ <table>
94
+ <caption>价格表</caption>
95
+ <tr><th scope="col">商品</th><th scope="col">价格</th></tr>
96
+ <tr><td>苹果</td><td>5</td></tr>
97
+ <tr><td colspan="2">**说明**:价格可随参数更新。</td></tr>
98
+ </table>
99
+ ```
100
+
101
+ 两种写法共用表格框架、标题、单元格样式和窄屏滚动。普通数字列使用相同的自动对齐规则;合并单元格保留其结构,单元格可用 `align` 明确设置对齐。原生表格默认不添加搜索、排序、分页或选择控件。
102
+
103
+ 支持 `colspan`、`rowspan`、`scope`、`headers` 和 `col` / `colgroup` 的 `span`。`colspan` 与 `span` 为 1–1000;`rowspan` 为 0–65534,其中 0 表示延伸到当前行组末尾。单元格和标题内继续解析 Markdown、公式、插值、图片及控件;省略的行组、行和单元格结束标签按 HTML 规则补齐,原始源码位置保持不变。
104
+
105
+ 同一表格混用 Markdown 表格行与 HTML 表格结构会产生诊断,并将该表格按原文显示。原生表格不接受 `bind`、`key`、`label`、`searchable`、`sortable`、`page-size` 等组件属性;标题用 `caption`,无障碍名称也可用 `aria-label`。代码示例中的结构标签不参与类型判断。
106
+
107
+ ### 原文回退
108
+
109
+ 成功转为惰性源码时发出 `local.html.fallback` 警告。未知 ReactiveMD 组件继续使用 `local.component.unknown`;致命编译失败仍返回 `ok: false`。宿主可以单独放行回退警告,同时保留对组件拼写错误的检查。详见[诊断契约](diagnostics-counting-ch.md#原生-html-安全回退)。
110
+
111
+ 无法编译的局部原生 HTML 按原文显示,其余 Markdown、公式和控件继续工作。回退覆盖不支持的标签或属性、无效的原生表格,以及缺少完整结束标记的 HTML 片段。无法找到结束标签时,片段截至当前段落或外层 ReactiveMD 容器的结束标签。回退片段中的 Markdown、`{{ 表达式 }}`、组件和脚本均保留为文本。
112
+
113
+ 原生 HTML 路径中,不支持的属性会使所在元素回退为原文;相邻元素继续渲染。整篇解析、序列化或编译预算检查失败时,React 预览和 standalone 挂载显示完整源码,保留换行并转义标签。`compileLocal` 的错误结果、资源限制和 `onDiagnostics` 诊断仍保留;配置错误及 ReactiveMD 组件语法错误继续按原规则处理。
114
+
76
115
  ## 扩展 HTML
77
116
 
78
117
  `enableExtendedHtml` 管理以下作者语法:
79
118
 
80
- - 表格及结构:`table`、`caption`、`thead`、`tbody`、`tfoot`、`tr`、`th`、`td`。
81
119
  - 定义列表:`dl`、`dt`、`dd`。
82
120
  - 补充文字语义:`small`、`kbd`、`samp`、`var`、`abbr`、`q`、`cite`、`ins`。
83
121
  - 图文和结构:`figure`、`figcaption`、`article`、`section`、`aside`、`header`、`footer`、`ruby`、`rt`、`rp`、`wbr`。
84
122
  - 原生表单、`iframe`、`object`、`embed`、`dialog`、任意 SVG/MathML 和整页 HTML 功能。
85
123
 
86
- 在默认模式中,已有的 ReactiveMD `<table>`、`<section>`、`<input>`、`<select>` 等组件继续采用当前语义。在原生 HTML 模式中,同名元素采用浏览器语义。
124
+ 在默认模式中,ReactiveMD `<table>` 按正文结构与原生表格区分;`<section>`、`<input>`、`<select>` 等同名组件继续采用当前语义。在原生 HTML 模式中,同名元素采用浏览器语义。
87
125
 
88
126
  ## 隔离与导出
89
127
 
@@ -95,4 +133,4 @@ React 快捷组件通过 `compileOptions` 接收同样的设置:
95
133
 
96
134
  交互导出保留本次编译选项和文档路径。原生 HTML 的静态导出保留浏览器内建的折叠和表单行为,并禁用作者 JavaScript。这类文档没有可保存的 ReactiveMD 参数。旧导出载荷省略编译选项时采用三个开关全部关闭的默认行为。
97
135
 
98
- 相关规则见[集成说明](local-integration-ch.md)、[可分享导出](shareable-export-ch.md)和[安全约定](../SECURITY-ch.md)。
136
+ 相关规则见[集成说明](../integration/local-integration-ch.md)、[可分享导出](../integration/shareable-export-ch.md)和[安全约定](../../SECURITY-ch.md)。
@@ -65,25 +65,63 @@ Lower-level hosts pass the compiled document to `LocalDocumentView`. Native HTML
65
65
  | Code | `code`, `pre`, and `code` inside `pre` |
66
66
  | Lists | `ul`, `ol`, `li`, including `ol[start]` |
67
67
  | Links and images | `a`, `img`, using the default path's URL policy |
68
+ | Native tables | `table`, `caption`, `colgroup`, `col`, `thead`, `tbody`, `tfoot`, `tr`, `th`, `td`; distinguished from ReactiveMD tables by their body structure |
68
69
  | Other forms | HTML comments, named and numeric character references, case-insensitive HTML names and void-element spelling |
69
70
 
70
71
  Container bodies continue to parse Markdown, formulas, interpolation and ReactiveMD controls. Code elements preserve literal content. `details` reuses the existing disclosure theme and interaction, with rich summaries, nesting and the `open` attribute. Static rendering expands the body. HTML boolean attributes use presence semantics, so `open="false"` still means open. Existing ReactiveMD component boolean rules stay unchanged.
71
72
 
72
- See the runnable [HTML and ReactiveMD example](../examples/local/html-compat.reactive.md).
73
+ See the runnable [HTML and ReactiveMD example](../../examples/local/html-compat.reactive.md).
74
+
75
+ `div`, `p` and `h1` through `h6` accept a static `align` attribute with `left`, `center`, `right` or `justify`. Values ignore case and surrounding whitespace. For example:
76
+
77
+ ```html
78
+ <div align="center">Hello</div>
79
+ <p align="right">A right-aligned **Markdown** paragraph.</p>
80
+ ```
81
+
82
+ Alignment works without enabling CSS or extended HTML. Markdown and bindings inside the container remain active, and nested elements can override the inherited alignment. The native HTML route accepts the same bounded values.
73
83
 
74
84
  Common attributes use an allowlist for document identifiers, titles, language, direction and accessibility. Author styles, event-handler attributes and unsupported elements in the default mode remain inert source or produce positioned diagnostics. Images still require explicit host approval. Code and unsupported regions execute no scripts.
75
85
 
86
+ Anchors accept static `target` and `rel` attributes, for example `<a href="https://example.com" target="_self" rel="nofollow">Open here</a>`. An explicit `target` overrides the default opening behavior; `rel` accepts whitespace-separated relationship tokens. In the default mixed mode, HTTP(S) links without these attributes retain `_blank` and `noopener noreferrer`, while relative links open in the current page. A `_blank` target preserves author relationship tokens, merges `noopener noreferrer` and removes the conflicting `opener` token. The sandboxed HTML route also accepts these attributes, retaining its restrictions on `_top`, `_parent` navigation and popups.
87
+
88
+ ## Two table syntaxes
89
+
90
+ A `<table>` containing a Markdown table remains a ReactiveMD component, with its existing search, sorting, pagination and row selection. A body with native table structure is parsed as an HTML table without enabling extended HTML or changing the whole document's mode:
91
+
92
+ ```html
93
+ <table>
94
+ <caption>Prices</caption>
95
+ <tr><th scope="col">Item</th><th scope="col">Price</th></tr>
96
+ <tr><td>Apple</td><td>5</td></tr>
97
+ <tr><td colspan="2">**Note**: prices can follow document parameters.</td></tr>
98
+ </table>
99
+ ```
100
+
101
+ Both syntaxes share the table frame, title, cell styles and narrow-screen scrolling. Plain numeric columns use the same automatic alignment rules. Merged cells preserve their structure; cells can set `align` explicitly. Native tables add no search, sorting, pagination or selection controls by default.
102
+
103
+ Supported attributes include `colspan`, `rowspan`, `scope`, `headers` and `span` on `col` / `colgroup`. `colspan` and `span` accept 1–1000; `rowspan` accepts 0–65534, with 0 extending to the end of the current row group. Cells and captions support Markdown, formulas, interpolation, images and controls. Omitted row groups, row ends and cell ends are normalized using HTML rules, while source locations retain their original offsets.
104
+
105
+ Mixing Markdown table rows and HTML table structure in one table produces a diagnostic and displays that table as source. Native tables reject component attributes such as `bind`, `key`, `label`, `searchable`, `sortable` and `page-size`; use `caption` for a title or `aria-label` for an accessible name. Structural tags inside code examples never determine the table type.
106
+
107
+ ### Source fallback
108
+
109
+ Successful conversion to inert source emits a `local.html.fallback` warning. Unknown ReactiveMD components retain `local.component.unknown`; fatal compilation still returns `ok: false`. Hosts can explicitly allow the fallback warning without allowing component spelling errors. See the [diagnostic contract](diagnostics-counting-en.md#safe-native-html-fallback).
110
+
111
+ Native HTML fragments that cannot compile are displayed as their original text, while surrounding Markdown, formulas and controls continue to work. This covers unsupported tags or attributes, invalid native tables and incomplete HTML fragments. An unclosed fragment ends at the current paragraph boundary or the enclosing ReactiveMD container's closing tag. Markdown, `{{ expressions }}`, components and scripts inside a fallback fragment stay literal.
112
+
113
+ In the native HTML route, an unsupported attribute makes its element fall back to source while neighboring elements continue to render. If whole-document parsing, serialization or compilation budget checks fail, React previews and standalone mounts display the complete source with preserved line breaks and escaped tags. Error results from `compileLocal`, resource limits and `onDiagnostics` reports are retained. Invalid host options and ReactiveMD component syntax errors keep their existing behavior.
114
+
76
115
  ## Extended HTML
77
116
 
78
117
  `enableExtendedHtml` controls the following author syntax:
79
118
 
80
- - Tables and their structure: `table`, `caption`, `thead`, `tbody`, `tfoot`, `tr`, `th`, `td`.
81
119
  - Definition lists: `dl`, `dt`, `dd`.
82
120
  - Additional text semantics: `small`, `kbd`, `samp`, `var`, `abbr`, `q`, `cite`, `ins`.
83
121
  - Figures and structure: `figure`, `figcaption`, `article`, `section`, `aside`, `header`, `footer`, `ruby`, `rt`, `rp`, `wbr`.
84
122
  - Native forms, `iframe`, `object`, `embed`, `dialog`, arbitrary SVG/MathML and whole-page HTML features.
85
123
 
86
- In the default mode, existing ReactiveMD components such as `table`, `section`, `input` and `select` retain their current meanings. In native HTML mode, these names use browser semantics.
124
+ In the default mode, `table` distinguishes native and ReactiveMD syntax by its body; existing components such as `section`, `input` and `select` retain their current meanings. In native HTML mode, these names use browser semantics.
87
125
 
88
126
  ## Isolation and export
89
127
 
@@ -95,4 +133,4 @@ Once arbitrary JavaScript is enabled, scripts can create elements and styles dyn
95
133
 
96
134
  Interactive export preserves compile options and the selected rendering path. Native HTML static export retains built-in browser disclosure and form behavior while disabling author JavaScript. These documents have no ReactiveMD parameters to save. Older export payloads without compile options use the default with all three capabilities off.
97
135
 
98
- See [integration](local-integration-en.md), [shareable export](shareable-export-en.md) and [security](../SECURITY.md).
136
+ See [integration](../integration/local-integration-en.md), [shareable export](../integration/shareable-export-en.md) and [security](../../SECURITY.md).
@@ -126,7 +126,7 @@ key 指定静态标识列,值必须非空、唯一且没有插值。提供 key
126
126
 
127
127
  local-draft-1 中已支持的写法继续有效。本扩展引入 10 个新组块名:jump、anchor、text、section、multi-select、range-slider、coordinate、quiz、steps、step。同一版本还增加声明标签 computed、const、validation 和结构标签 data-table、column,`local-draft-2` 的完整集合为 48 个标签名;开头的 `<theme>` 声明是元数据,不计入组块。新名称以前会作为未知源码惰性显示,现在开始解释其中的受支持内容;若原文用于演示标签,放进代码围栏或行内代码。checklist 的完成样式是可见变化。
128
128
 
129
- 机器验收沿用 component-protocol-1 的格式,syntaxVersion 更新为 local-draft-2;旧 local-draft-1.json 留作历史数据,新构建运行 local-draft-2.json。新组件另有核心、渲染和可视化用例。错误仍使用带源码位置的 Diagnostic,未知标签、脚注、安全与资源预算保持已有契约。同一版本还新增表达式函数保留名;完整重命名清单见[0.4.0 发布与迁移](release-0.4.0-ch.md)。
129
+ 机器验收沿用 component-protocol-1 的格式,syntaxVersion 更新为 local-draft-2;旧 local-draft-1.json 留作历史数据,新构建运行 local-draft-2.json。新组件另有核心、渲染和可视化用例。错误仍使用带源码位置的 Diagnostic,未知标签、脚注、安全与资源预算保持已有契约。同一版本还新增表达式函数保留名;完整重命名清单见[0.4.0 发布与迁移](../releases/release-0.4.0-ch.md)。
130
130
 
131
131
  | 协议条款 | 实现与证据入口 |
132
132
  | --- | --- |
@@ -135,4 +135,4 @@ local-draft-1 中已支持的写法继续有效。本扩展引入 10 个新组
135
135
  | CP-A11Y、CP-STYLE | LocalDocumentView、visuals 及相应样式;SSR 与浏览器检查 |
136
136
  | CP-CORE、CP-COMPAT、CP-ACCEPT | 独立 core/React 构建、机器验收、打包和本页迁移说明 |
137
137
 
138
- 双语可运行示例分布在[六个场景](../examples/local/showcase/README.md):函数场景包含区间、坐标与数值题;表单场景包含多选;统计场景包含表格与图表选择联动;布局场景包含跳转与正文颜色;流程场景包含分步阅读与选择题;清单场景包含待办与计时。自动检查命令为 `npm test`、`npm run test:components`、`npm run build:demo`、`npm run test:docs`;浏览器检查和完整发布门禁使用 `npm run verify:release`,见[贡献指南](../CONTRIBUTING-ch.md)。实际结果以该门禁的执行记录为准,不要沿用旧脚本名。
138
+ 双语可运行示例分布在[六个场景](../../examples/local/showcase/README.md):函数场景包含区间、坐标与数值题;表单场景包含多选;统计场景包含表格与图表选择联动;布局场景包含跳转与正文颜色;流程场景包含分步阅读与选择题;清单场景包含待办与计时。自动检查命令为 `npm test`、`npm run test:components`、`npm run build:demo`、`npm run test:docs`;浏览器检查和完整发布门禁使用 `npm run verify:release`,见[贡献指南](../../CONTRIBUTING-ch.md)。实际结果以该门禁的执行记录为准,不要沿用旧脚本名。
@@ -99,6 +99,6 @@ key names a column of static, nonempty, unique text identifiers. Selection is en
99
99
 
100
100
  Previously supported local-draft-1 source remains valid. Ten new names arrive with this extension: jump, anchor, text, section, multi-select, range-slider, coordinate, quiz, steps and step. The same release also adds the declaration tags computed, const and validation and the structural tags data-table and column, for 48 tag names in the complete `local-draft-2` set; the leading `<theme>` declaration is metadata, not a component. Old builds displayed these unknown regions as inert source; this build interprets their supported content. Put literal examples inside code spans or fences. Checklist completion appearance changes visibly.
101
101
 
102
- Portable fixture syntaxVersion advances to local-draft-2; component-protocol-1 and its data format stay unchanged. local-draft-1.json is retained as historical data. New tests cover compiler/runtime, SSR rendering and visual selection. Canonical state, atomic rejection/reset, instance isolation, hidden-state retention, positioned diagnostics, existing resource budgets and the core/React boundary follow the component protocol. The same release also reserves new expression function names; see [0.4.0 release and migration](release-0.4.0-en.md) for the full rename list.
102
+ Portable fixture syntaxVersion advances to local-draft-2; component-protocol-1 and its data format stay unchanged. local-draft-1.json is retained as historical data. New tests cover compiler/runtime, SSR rendering and visual selection. Canonical state, atomic rejection/reset, instance isolation, hidden-state retention, positioned diagnostics, existing resource budgets and the core/React boundary follow the component protocol. The same release also reserves new expression function names; see [0.4.0 release and migration](../releases/release-0.4.0-en.md) for the full rename list.
103
103
 
104
- Run `npm test`, `npm run test:components`, `npm run build:demo` and `npm run test:docs`. Browser checks and the complete release gate use `npm run verify:release`; see the [contributing guide](../CONTRIBUTING.md). Record actual run results with the gate rather than copying an old script name. The bilingual [six scenarios](../examples/local/showcase/README.md) cover all components: ranges, coordinates and numeric questions in Functions; multiple selection in Forms; linked selection in Data; jumps and prose colors in Layout; steps and choice questions in Flow; todos and timing in Checklists.
104
+ Run `npm test`, `npm run test:components`, `npm run build:demo` and `npm run test:docs`. Browser checks and the complete release gate use `npm run verify:release`; see the [contributing guide](../../CONTRIBUTING.md). Record actual run results with the gate rather than copying an old script name. The bilingual [six scenarios](../../examples/local/showcase/README.md) cover all components: ranges, coordinates and numeric questions in Functions; multiple selection in Forms; linked selection in Data; jumps and prose colors in Layout; steps and choice questions in Flow; todos and timing in Checklists.
@@ -2,7 +2,7 @@
2
2
 
3
3
  本次新增的跳转、正文颜色、多选、区间、坐标、练习题、分步阅读和选择联动,见[新增组块与迁移](local-components-v2-ch.md)。
4
4
 
5
- 语法标识:`local-draft-2`,2026-10-23。第一次接触这套语法,建议先读 [新用户入门指南](local-guide-ch.md);本文是完整规范。宿主通过 `compileLocal` 和 `LocalReactiveDocument` 选择本地交互模式,见 [集成说明](local-integration-ch.md)。包版本关系、0.x 兼容规则和迁移见 [版本与兼容性](compatibility-ch.md),可选修订指令与 `reactive-md migrate` 见[源码修订与迁移](source-versioning-ch.md),从 `0.3.1` / `local-draft-1` 升级见[0.4.0 发布与迁移](release-0.4.0-ch.md)。完整示例见 [示例索引](../examples/local/README.md)。
5
+ 语法标识:`local-draft-2`,2026-10-23。第一次接触这套语法,建议先读 [新用户入门指南](../guides/local-guide-ch.md);本文是完整规范。宿主通过 `compileLocal` 和 `LocalReactiveDocument` 选择本地交互模式,见 [集成说明](../integration/local-integration-ch.md)。包版本关系、0.x 兼容规则和迁移见 [版本与兼容性](../compatibility/compatibility-ch.md),可选修订指令与 `reactive-md migrate` 见[源码修订与迁移](../compatibility/source-versioning-ch.md),从 `0.3.1` / `local-draft-1` 升级见[0.4.0 发布与迁移](../releases/release-0.4.0-ch.md)。完整示例见 [示例索引](../../examples/local/README.md)。
6
6
 
7
7
  ## 1. 定位与范围
8
8
 
@@ -20,7 +20,7 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
20
20
 
21
21
  本草案不包含外部服务调用、提交表单、异步资源、命名动作、事件处理器、可编程集合增删、通用循环模板或任意脚本。旧版 `state/data/computed/actions` 配置块不属于新语法。表达式可以产生字符串或数字数组,清单与多选组件继续产生字符串数组。表格可直接写为 Markdown,也可通过带预算的 `data-table` 从本地值生成行。
22
22
 
23
- 文档默认只保存当前实例的内存状态。重新打开从初值开始;持久化不属于作者语法。无需声明语言版本、导入组件或编写 YAML。文档可以在前导区、主题和正文之前用一行 `<!-- reactive-md: local-draft-2 -->` 可选地声明修订;无指令文档使用当前修订。见[源码修订与迁移](source-versioning-ch.md)。宿主应明确选择草案解析模式,不能把旧语法与新语法混合猜测解析。
23
+ 文档默认只保存当前实例的内存状态。重新打开从初值开始;持久化不属于作者语法。无需声明语言版本、导入组件或编写 YAML。文档可以在前导区、主题和正文之前用一行 `<!-- reactive-md: local-draft-2 -->` 可选地声明修订;无指令文档使用当前修订。见[源码修订与迁移](../compatibility/source-versioning-ch.md)。宿主应明确选择草案解析模式,不能把旧语法与新语法混合猜测解析。
24
24
 
25
25
  文档可在正文前用 `<theme name="default">` 选择整份文档的主题,省略时为 `default`。这是静态元数据声明,不是组件;自定义主题须由宿主登记并同时支持深浅模式,见[主题协议](theme-protocol-ch.md)。
26
26
 
@@ -47,6 +47,8 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
47
47
 
48
48
  标题、段落、强调、链接、图片、引用、列表、普通表格、行内代码和代码围栏继续使用 Markdown。组件标签可以位于段落或独立块中,其位置由组件类型决定。容器内部继续解析 Markdown,不要求作者额外添加 `markdown` 属性。
49
49
 
50
+ 代码围栏支持常见编程语言,以及 `latex` / `tex`、`cattca`、`mermaid`、`jinja` / `jinja2`、`dockerfile` / `docker` 和 `vue` 的语法高亮。Vue 单文件组件中的模板、JavaScript / TypeScript、CSS / SCSS 分别高亮;Cattca 按 Markdown 正文与命令块高亮。Mermaid 围栏展示带高亮的源码。无语言标注时,在受限的常用语言集合中自动识别,并在工具栏显示识别出的语言;识别证据不足时保留纯文本。用 `text`、`txt`、`plaintext` 或 `nohighlight` 明确指定纯文本。未知语言和超过 20,000 字符的代码块保留原文;高亮与复制均保留源码空白。
51
+
50
52
  块组件的开始与结束标签各占一行。开始标签的属性可以跨多行书写。标签内部的 `>` 只有在引号之外才结束标签。缩进只用于可读性:容器内容按共同缩进量去缩进,再按 Markdown 解析;代码围栏内部的缩进保持原样。
51
53
 
52
54
  行内组件 `badge`、`tooltip`、`jump`、`text` 可以嵌入句子。其他组件为块组件;`option`、`tab`、`disclosure`、`node`、`edge` 是限定父容器内的子组件。
@@ -272,7 +274,7 @@ if 的 when 为假时不显示内容,内部参数仍按第 4 节初始化。
272
274
 
273
275
  `jump.to` 与 `anchor.id` 匹配标题锚点或显式 ID。重复 anchor、与标题锚点冲突或目标不存在都是编译错误。`quiz` 的答案随源码提供,适合自学;草稿和反馈保留在组件内部,面板重置会清除。`steps` 中未激活的步骤仍参与初始化并保留状态;隐藏计时器暂停。颜色校验和槽位细节见[local-draft-2 扩展说明](local-components-v2-ch.md)。
274
276
 
275
- 基础排版使用 Markdown;图片用 `![说明](路径)`,链接用 `[文字](地址)`,分隔线用 `---`。图片需由宿主通过 URL 策略明确允许后才加载,默认不产生图片请求,集成方式见[图片与链接策略](local-integration-ch.md#图片与链接策略)。本草案不提供 row、stack、spacer、icon、image、link-button 等对应的作者标签,也不开放 class/style。
277
+ 基础排版使用 Markdown;图片用 `![说明](../路径)`,链接用 `[文字](../地址)`,分隔线用 `---`。图片需由宿主通过 URL 策略明确允许后才加载,默认不产生图片请求,集成方式见[图片与链接策略](../integration/local-integration-ch.md#图片与链接策略)。本草案不提供 row、stack、spacer、icon、image、link-button 等对应的作者标签,也不开放 class/style。
276
278
 
277
279
  ## 8. 可勾选清单
278
280
 
@@ -297,7 +299,9 @@ progress 是无正文组件,label/value 必填,max 默认 100,支持动态
297
299
 
298
300
  ### 9.1 共同的数据规则
299
301
 
300
- table、chart、timeline 的正文各为一张 Markdown 表格。表头非空且唯一,每行列数一致;单元格可以有插值。第一列通常为标签,其他列根据组件要求读取类型。
302
+ ReactiveMD 的 table、chart、timeline 组件正文各为一张 Markdown 表格。表头非空且唯一,每行列数一致;单元格可以有插值。第一列通常为标签,其他列根据组件要求读取类型。
303
+
304
+ `<table>` 也可使用原生 HTML 表格正文;两种语法按正文结构区分,共用渲染样式。HTML 写法支持合并单元格,默认不添加表格交互,详见 [HTML 表格兼容](html-compatibility-ch.md#两种表格写法)。
301
305
 
302
306
  普通文本单元格显示 Markdown;纯十进制或科学计数法文本单元格可读为数值,单个完整插值保留其结果类型。混合文本如 `{{ price }} 元` 是显示字符串,不能用作图表的数值列。图例标签取表头的纯文本。
303
307
 
@@ -350,7 +354,22 @@ timeline 支持可选 title、unit(显示文本,默认“分钟”),正
350
354
 
351
355
  ### 10.1 显示与绘图
352
356
 
353
- 正文 `$...$` 是行内数学,`$$...$$` 是独立公式。行内数学在同一行配对,内容首尾不能是空白;用 `\$` 显示普通美元符号。独立公式可以跨行,也可以写成 `$$ y = x^2 $$`。未闭合的数学定界符报错。单独公式用于排版,不创建状态、不发布函数。plot 容器内的每个 `$$...$$` 块定义一条曲线,数学内容保持正常 LaTeX 写法,不需要 `{{ }}`。
357
+ 正文用 `$...$` 或 `\(...\)` 写行内公式,用 `$$...$$` 或 `\[...\]` 写独立公式。美元定界的行内公式在同一行配对,允许首尾空白,例如 `$ x $`、`$x $`、`$ x$`;内容须包含非空白字符。普通金额文本(如 `$5 and $10`)保持字面含义,普通美元符号也可写 `\$`。反斜线定界的公式允许首尾空白和跨行,例如句子中的 `\(\frac{a}{b}\)`,或独立公式 `\[x^2 + 1\]`。未闭合的公式定界符报错;没有配对的单个美元符号保留为文本。代码、注释和 Markdown 链接目标中的定界符保持字面含义;正文中展示写法时,转义开头的反斜线或使用代码。
358
+
359
+ 独立公式用于排版,不创建状态、不发布函数。plot 容器内每个 `$$...$$` 块定义一条曲线,数学内容保持正常 LaTeX 写法,不需要 `{{ }}`。plot 仍只接受 `$$...$$`,不接受 `\(...\)` 或 `\[...\]`。
360
+
361
+ 排版支持 `cases`、`aligned`、`align`、`align*`、`pmatrix`、`bmatrix`、`vmatrix` 环境。用 `&` 分列,`\\` 换行;对齐环境按右、左交替对齐列,矩阵单元格居中,并显示对应括号。`align` 与 `aligned` 均在公式定界符内使用;编号通过 `\tag{1}` 显式添加,`\tag*{A}` 不加括号。
362
+
363
+ | 排版内容 | 命令示例 |
364
+ | --- | --- |
365
+ | 字体与文本 | `\mathbb{R}`、`\mathcal{F}`、`\mathscr{L}`、`\mathfrak{g}`、`\textbf{文字}` |
366
+ | 组合数、标注与边框 | `\binom{n}{k}`、`\underbrace{a+b}_{n}`、`\overrightarrow{AB}`、`\underline{x}`、`\boxed{x}` |
367
+ | 上下标注与带标签箭头 | `\stackrel{!}{=}`、`\underset{x}{\lim}`、`\xrightarrow[下方]{上方}`、`\xrightleftharpoons[k_2]{k_1}` |
368
+ | 逻辑、关系与符号 | `\implies`、`\iff`、`\not\in`、`\cong`、`\mapsto`、`\mid`、`\ll`、`\oplus`、`\varnothing`、`\therefore`、`\because`、`\triangle`、`\circ`、`\dagger`、`\vdots`、`\ddots` |
369
+ | 箭头、定界符与尺寸 | `\rightleftharpoons`、`\longrightarrow`、`\Longleftrightarrow`、`\downarrow`、`\lfloor`、`\rfloor`、`\lceil`、`\rceil`、`\bigl(`、`\bigr)`、`\Bigg(` |
370
+ | 函数与同余 | `\sec`、`\csc`、`\cot`、`\sinh`、`\cosh`、`\lg`、`\pmod{n}` |
371
+
372
+ 化学式使用 mhchem 语法 `\ce{...}`,例如 `$\ce{H2O}$`、`$\ce{SO4^2-}$`、`$\ce{^{14}_{6}C}$`、`$$\ce{2 H2 + O2 -> 2 H2O}$$`、`$$\ce{A <=>[正向][逆向] B}$$`。支持分子下标、离子电荷、同位素、系数、物态、化学键和反应箭头,由 `mhchemparser` 转换并通过同一 MathML 渲染器排版。未支持的转换命令会给出 `local.math.display` 诊断;所有文本经过转义,转换结果受长度、记号和嵌套预算限制。这些排版语法可在普通公式中使用;绘图计算支持的语法见下一节。
354
373
 
355
374
  ```markdown
356
375
  <slider bind="a" label="振幅" initial="1" min="0" max="5">
@@ -486,7 +505,7 @@ node.id 为当前图解内唯一的 `[A-Za-z_][A-Za-z0-9_-]*`。edge 必填 from
486
505
  9. 中文输入法、键盘操作、可访问名称和 375px 窄屏可用。
487
506
  10. 文档实例独立、销毁清理、无意外网络动作;复杂或超量数学输入能够被执行预算中止。
488
507
 
489
- 这些规则用于编译器、运行时和浏览器验收。示例映射及预期观察点见[示例索引](../examples/local/README.md),机器可读的最小验收集见[语言验收数据](../examples/conformance/README.md)。实际仓库检查记录保留在仓库内,不属于发布包。
508
+ 这些规则用于编译器、运行时和浏览器验收。示例映射及预期观察点见[示例索引](../../examples/local/README.md),机器可读的最小验收集见[语言验收数据](../../examples/conformance/README.md)。实际仓库检查记录保留在仓库内,不属于发布包。
490
509
 
491
510
 
492
- 新增组块、颜色、槽位状态与迁移规则见[local-draft-2 扩展说明](local-components-v2-ch.md),升级清单见[0.4.0 发布与迁移](release-0.4.0-ch.md)。`0.4.0` 是 `next` 渠道的预览版。
511
+ 新增组块、颜色、槽位状态与迁移规则见[local-draft-2 扩展说明](local-components-v2-ch.md),升级清单见[0.4.0 发布与迁移](../releases/release-0.4.0-ch.md)。`0.6.0` 同时提供于 `latest` 与 `next` 渠道。