reactive-md 0.5.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 (48) hide show
  1. package/CHANGELOG-ch.md +16 -0
  2. package/CHANGELOG.md +16 -0
  3. package/README-ch.md +9 -7
  4. package/README-en.md +10 -7
  5. package/README.md +10 -7
  6. package/SECURITY-ch.md +4 -3
  7. package/SECURITY.md +4 -3
  8. package/THIRD_PARTY_NOTICES.md +45 -1
  9. package/dist-library/reactive-md-editor.css +1 -1
  10. package/dist-library/reactive-md-editor.js +739 -615
  11. package/dist-library/reactive-md-react.js +2081 -1904
  12. package/dist-library/reactive-md.js +440 -320
  13. package/dist-library/{runtime-DPuMxM_y.js → runtime-CXBdLQ3A.js} +8405 -2745
  14. package/dist-library/types/editor/editor-i18n.d.ts +7 -0
  15. package/dist-library/types/editor/editor-view-bar.d.ts +11 -0
  16. package/dist-library/types/editor/index.d.ts +1 -1
  17. package/dist-library/types/editor/types.d.ts +8 -1
  18. package/dist-library/types/local/LocalDocumentView.d.ts +10 -3
  19. package/dist-library/types/local/code-block.d.ts +3 -1
  20. package/dist-library/types/local/diagnostics.d.ts +25 -0
  21. package/dist-library/types/local/heading-anchors.d.ts +2 -0
  22. package/dist-library/types/local/html.d.ts +16 -0
  23. package/dist-library/types/local/image-view.d.ts +3 -1
  24. package/dist-library/types/local/index.d.ts +1 -1
  25. package/dist-library/types/local/options.d.ts +29 -0
  26. package/dist-library/types/local/types.d.ts +35 -1
  27. package/dist-library/types/local/worker.d.ts +18 -6
  28. package/dist-library/types/shareable.d.ts +9 -1
  29. package/dist-standalone/reactive-md-standalone.js +48 -48
  30. package/docs/compatibility-ch.md +4 -4
  31. package/docs/compatibility-en.md +4 -4
  32. package/docs/editor-ch.md +235 -216
  33. package/docs/editor-en.md +235 -216
  34. package/docs/html-compatibility-ch.md +98 -0
  35. package/docs/html-compatibility-en.md +98 -0
  36. package/docs/local-integration-ch.md +4 -1
  37. package/docs/local-integration-en.md +4 -1
  38. package/docs/local-interaction-syntax-ch.md +3 -1
  39. package/docs/local-interaction-syntax-en.md +1 -1
  40. package/docs/release-0.5.1-ch.md +39 -0
  41. package/docs/release-0.5.1-en.md +39 -0
  42. package/docs/releasing-ch.md +7 -7
  43. package/docs/releasing-en.md +8 -8
  44. package/docs/shareable-export-ch.md +2 -0
  45. package/docs/shareable-export-en.md +2 -0
  46. package/examples/local/README.md +2 -0
  47. package/examples/local/html-compat.reactive.md +24 -0
  48. package/package.json +3 -1
@@ -0,0 +1,98 @@
1
+ # Partial HTML compatibility and temporary routing policy
2
+
3
+ This feature targets the next release. Documents use Markdown, ReactiveMD controls and expressions by default, with the P0 HTML subset below. Host applications can enable author CSS, JavaScript and extended HTML separately. All three options default to `false`.
4
+
5
+ ## Temporary routing policy
6
+
7
+ This release routes whole documents to avoid mixed parsing and rendering conflicts between author CSS, JavaScript, extended HTML and ReactiveMD.
8
+
9
+ | Compile options | Document behavior |
10
+ | --- | --- |
11
+ | All three options omitted or `false` | ReactiveMD parsing and the existing React renderer, including P0 HTML |
12
+ | Any option `true` | Native HTML for the entire source, rendered in an isolated iframe |
13
+
14
+ In native HTML mode, `# headings`, `**emphasis**`, LaTeX and `{{ expressions }}` remain ordinary text. Elements such as `input` and `table` use HTML semantics. ReactiveMD components establish no bindings. Turning all options off recompiles the document in the default mode. This is a transitional policy for this release; mixed compatibility can be evaluated later.
15
+
16
+ Options are host capabilities. Source tags and parameter state files cannot grant them. The demo displays the active mode and resets all three capabilities when the page reloads.
17
+
18
+ ## Options and API
19
+
20
+ ```ts
21
+ import { compileLocal } from 'reactive-md';
22
+
23
+ // Markdown, ReactiveMD and P0 HTML.
24
+ const reactive = compileLocal(source);
25
+
26
+ // Native HTML for the entire source; author CSS is enabled.
27
+ const html = compileLocal(source, {
28
+ enableCss: true,
29
+ enableJavaScript: false,
30
+ enableExtendedHtml: false,
31
+ });
32
+ ```
33
+
34
+ | Option | Default | Capability |
35
+ | --- | --- | --- |
36
+ | `enableCss` | `false` | Author CSS |
37
+ | `enableJavaScript` | `false` | Author scripts and event handlers |
38
+ | `enableExtendedHtml` | `false` | P1 elements, embeds, forms, SVG/MathML and whole-page HTML features |
39
+
40
+ Each option must be boolean. Enabling one does not enable the others. Styled extended elements require both extended HTML and CSS; scripts in extended elements require both extended HTML and JavaScript. Built-in styles, interactions, chart SVG and formula MathML continue to work independently of these author capabilities.
41
+
42
+ Source-length limits and `limits.maxSyntaxNodes` still apply. The HTML path counts traversed parse-tree nodes, with a cumulative budget shared by nested `srcdoc` documents.
43
+
44
+ The React convenience component accepts the same settings through `compileOptions`:
45
+
46
+ ```tsx
47
+ <LocalReactiveDocument
48
+ source={source}
49
+ compileOptions={{ enableCss: true }}
50
+ />
51
+ ```
52
+
53
+ Lower-level hosts pass the compiled document to `LocalDocumentView`. Native HTML documents have a `document.html` field with the three normalized flags and empty parameter and binding collections. This field is runtime metadata. Store the original source and host settings when saving a document.
54
+
55
+ ## P0 HTML in the default mode
56
+
57
+ | Purpose | Elements |
58
+ | --- | --- |
59
+ | Inline text | `b`, `strong`, `i`, `em`, `s`, `del`, `u`, `mark`, `sup`, `sub` |
60
+ | Breaks | `br`, `hr` |
61
+ | Paragraphs and headings | `p`, `h1` through `h6` |
62
+ | Containers | `div`, `span` |
63
+ | Disclosures | `details`, `summary` |
64
+ | Quotations | `blockquote` |
65
+ | Code | `code`, `pre`, and `code` inside `pre` |
66
+ | Lists | `ul`, `ol`, `li`, including `ol[start]` |
67
+ | Links and images | `a`, `img`, using the default path's URL policy |
68
+ | Other forms | HTML comments, named and numeric character references, case-insensitive HTML names and void-element spelling |
69
+
70
+ 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
+ See the runnable [HTML and ReactiveMD example](../examples/local/html-compat.reactive.md).
73
+
74
+ 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
+
76
+ ## Extended HTML
77
+
78
+ `enableExtendedHtml` controls the following author syntax:
79
+
80
+ - Tables and their structure: `table`, `caption`, `thead`, `tbody`, `tfoot`, `tr`, `th`, `td`.
81
+ - Definition lists: `dl`, `dt`, `dd`.
82
+ - Additional text semantics: `small`, `kbd`, `samp`, `var`, `abbr`, `q`, `cite`, `ins`.
83
+ - Figures and structure: `figure`, `figcaption`, `article`, `section`, `aside`, `header`, `footer`, `ruby`, `rt`, `rp`, `wbr`.
84
+ - Native forms, `iframe`, `object`, `embed`, `dialog`, arbitrary SVG/MathML and whole-page HTML features.
85
+
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.
87
+
88
+ ## Isolation and export
89
+
90
+ Author HTML runs inside a sandboxed iframe without `allow-same-origin`. Whole-page structure, styles and scripts apply to this isolated document. CSP and sandbox restrictions still govern resources, form submission and navigation. Extended HTML does not grant unrestricted network access.
91
+
92
+ This release supports inline CSS and JavaScript. Enabling the options does not automatically load external scripts, stylesheets, images, media or embedded resources. Extended HTML permits HTTP(S) form submission and `base` URL resolution inside the isolated document while retaining host-access and top-navigation restrictions. Iframes can use `srcdoc` for inline content; external `object` and `embed` resources remain subject to CSP.
93
+
94
+ Once arbitrary JavaScript is enabled, scripts can create elements and styles dynamically. The other options primarily constrain author source; they do not promise to block individual runtime DOM operations. Host isolation remains in place.
95
+
96
+ 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
+
98
+ See [integration](local-integration-en.md), [shareable export](shareable-export-en.md) and [security](../SECURITY.md).
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## 运行环境与入口
6
6
 
7
+ 下个发行版的 P0 HTML 和三个宿主能力开关见 [HTML 部分兼容](html-compatibility-ch.md)。本版采用暂时性分流政策:任意开启作者 CSS、JavaScript 或扩展 HTML,整篇文档即按原生 HTML 渲染,停止解析 Markdown 和 ReactiveMD。
8
+
7
9
  | 入口 | 内容 | 依赖 |
8
10
  | --- | --- | --- |
9
11
  | `reactive-md` | `compileLocal`、`createLocalRuntime`、表达式与数学工具 | 不依赖 React |
@@ -42,6 +44,7 @@ export function Article() {
42
44
  | 属性 | 类型 | 组件 | 说明 |
43
45
  | --- | --- | --- | --- |
44
46
  | `source` | `string` | `LocalReactiveDocument` | 源码变化时重新编译并创建新运行时;旧实例状态不保留。见[源码变化时保留参数](#源码变化时保留参数) |
47
+ | `compileOptions` | `LocalCompileOptions` | `LocalReactiveDocument` | 单次编译预算和 HTML 能力开关;省略时使用默认 ReactiveMD 模式 |
45
48
  | `document` | `LocalDocument` | `LocalDocumentView` | 已编译文档;由宿主编译一次 |
46
49
  | `runtime` | `LocalRuntime` | `LocalDocumentView` | 宿主创建并负责销毁 |
47
50
  | `onDiagnostics` | `(diagnostics: Diagnostic[]) => void` | 两者 | 接收编译诊断和控件写入被拒绝时的运行时诊断 |
@@ -357,7 +360,7 @@ const urlPolicy: LocalUrlPolicy = (raw, kind) => {
357
360
 
358
361
  ## 不提供的功能
359
362
 
360
- 本地模式不提供自动状态持久化或网络访问,也不提供插件或自定义组件注册、任意 HTML、作者 CSS、事件处理器、外部数据接口、表单提交、Vue 支持、React 18 支持或 CommonJS 入口。状态导出与导入是宿主的显式调用;运行时本身不会保存或发送状态。`LocalReactiveDocument` 在源码变化时仍从初值开始;请使用参数保留工具,或自行提供运行时和文档。宿主不应把这些能力当作可配置项。
363
+ 默认 ReactiveMD 路径支持 P0 HTML。作者 CSS、JavaScript 和扩展 HTML 的宿主开关使用独立的原生 HTML 路径,见 [HTML 部分兼容](html-compatibility-ch.md)。本地模式仍不提供自动状态持久化或不受限的网络访问、插件或自定义组件注册、外部数据接口、Vue 支持、React 18 支持或 CommonJS 入口。状态导出与导入是宿主的显式调用。`LocalReactiveDocument` 在源码变化时从初值开始;需要保留参数时使用保留工具,或自行管理运行时和文档。
361
364
 
362
365
 
363
366
  新增组块、颜色、槽位状态与迁移规则见[local-draft-2 扩展说明](local-components-v2-ch.md),升级清单见[0.4.0 发布与迁移](release-0.4.0-ch.md)。`0.4.0` 是 `next` 渠道的预览版。
@@ -4,6 +4,8 @@ Local interaction mode uses HTML-style tags, in-place parameters and `{{ express
4
4
 
5
5
  ## Runtime and entries
6
6
 
7
+ See [HTML compatibility](html-compatibility-en.md) for the next release's P0 HTML support and host capability options. The temporary routing policy sends the entire document to native HTML when author CSS, JavaScript or extended HTML is enabled. Markdown and ReactiveMD interpretation stop in that path.
8
+
7
9
  | Entry | Contents | Dependency |
8
10
  | --- | --- | --- |
9
11
  | `reactive-md` | `compileLocal`, `createLocalRuntime`, expression and math utilities | No React dependency |
@@ -42,6 +44,7 @@ export function Article() {
42
44
  | Prop | Type | Component | Notes |
43
45
  | --- | --- | --- | --- |
44
46
  | `source` | `string` | `LocalReactiveDocument` | Recompiles and creates a new runtime when the source changes; old instance state is not kept. See [Keeping values when source changes](#keeping-values-when-source-changes) |
47
+ | `compileOptions` | `LocalCompileOptions` | `LocalReactiveDocument` | Per-compilation limits and HTML capability flags; omitted options use the default ReactiveMD path |
45
48
  | `document` | `LocalDocument` | `LocalDocumentView` | Compiled document; compiled once by the host |
46
49
  | `runtime` | `LocalRuntime` | `LocalDocumentView` | Created by the host, which is responsible for disposal |
47
50
  | `onDiagnostics` | `(diagnostics: Diagnostic[]) => void` | Both | Receives compile diagnostics and runtime diagnostics when control writes are rejected |
@@ -357,7 +360,7 @@ These limits bound the work for a single document; they do not replace host cont
357
360
 
358
361
  ## Features not provided
359
362
 
360
- Local mode does not provide automatic state persistence or network access, plugins or custom component registration, arbitrary HTML, author CSS, event handlers, external data APIs, form submission, Vue support, React 18 support or a CommonJS entry. State export and import are explicit host calls; the runtime never saves or sends state by itself. `LocalReactiveDocument` still starts from initial values when the source changes; use the retention helpers or supply your own runtime and document. Hosts should not treat these capabilities as configuration options.
363
+ The default ReactiveMD path supports P0 HTML. Host options for author CSS, JavaScript and extended HTML use the separate native HTML path described in [HTML compatibility](html-compatibility-en.md). Local mode still provides no automatic state persistence or unrestricted network access, plugins or custom component registration, external data APIs, Vue support, React 18 support or a CommonJS entry. State export and import are explicit host calls. `LocalReactiveDocument` starts from initial values when the source changes; use retention helpers or manage the runtime and document yourself.
361
364
 
362
365
 
363
366
  See [local-draft-2 components and migration](local-components-v2-en.md) for new tags, colors and slot state, and [0.4.0 release and migration](release-0.4.0-en.md) for the upgrade checklist. `0.4.0` is the preview release on the `next` channel.
@@ -6,6 +6,8 @@
6
6
 
7
7
  ## 1. 定位与范围
8
8
 
9
+ 下个发行版新增的 P0 HTML 和作者能力开关见 [HTML 部分兼容](html-compatibility-ch.md)。本规范描述三个开关全部关闭的默认路径;任意开启作者 CSS、JavaScript 或扩展 HTML 时,按照暂时性分流政策将整篇源码交给原生 HTML 路径。
10
+
9
11
  `0.4.0` 新增不可见的 `computed`/`const` 声明与数字、字符串、日期函数。声明语法、依赖与错误规则、函数签名及固定默认值见[复用计算与格式化数值](computations-formatting-ch.md)。
10
12
 
11
13
  跨字段校验、条件样式、数组与有限表格行生成见[条件、校验与本地集合](constraints-collections-ch.md)。
@@ -98,7 +100,7 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
98
100
 
99
101
  正文中的 `Array<T>`、`Map<string, number>`、`x<y` 和货币 `$5`、`$10` 按文字处理;完整公式仍使用 `$...$` 或 `$$...$$`。单个未配对美元符号按文字显示。
100
102
 
101
- 支持无属性的 `<b>...</b>`、`<i>...</i>`、`<u>...</u>`、`<s>...</s>`、`<mark>...</mark>` 和 `<br>` / `<br/>`,分别生成加粗、斜体、下划线、删除线、高亮和硬换行节点。它们属于正文格式,不是交互组件;普通单换行仍按 Markdown 软换行处理。
103
+ 默认路径支持 [P0 HTML 清单](html-compatibility-ch.md#默认支持的-p0-html)中的文字格式、标题、容器、折叠、引用、代码、列表、链接和图片。它们生成受控节点,复用现有主题和渲染方式。普通单换行仍按 Markdown 软换行处理。
102
104
 
103
105
  脚注用 `[^note]` 引用,定义写为 `[^note]: 内容`,续写段落、列表和代码块按 Markdown 缩进。定义支持 Markdown 与上述基础 HTML。按首次引用顺序生成文末编号列表,重复引用共享编号并分别提供返回链接;标识符不区分大小写,重复定义采用第一条。未定义引用保留为文字,未引用定义不显示。脚注内的控件和插值保持为文字,不建立绑定或执行表达式。
104
106
 
@@ -96,7 +96,7 @@ Unknown components, unknown attributes, wrong positions or wrong attribute types
96
96
 
97
97
  Prose such as `Array<T>`, `Map<string, number>`, `x<y` and currency `$5` or `$10` stays text. Complete formulas still use `$...$` or `$$...$$`; an unmatched single dollar sign stays literal.
98
98
 
99
- Attribute-free `<b>...</b>`, `<i>...</i>`, `<u>...</u>`, `<s>...</s>`, `<mark>...</mark>` and `<br>` / `<br/>` produce bold, italic, underline, strikethrough, highlight and hard-break nodes. These are prose formatting, not interaction components. Ordinary single newlines remain Markdown soft breaks.
99
+ The default path accepts the [P0 HTML subset](html-compatibility-en.md#p0-html-in-the-default-mode): text formatting, headings, containers, disclosures, quotations, code, lists, links and images. It produces controlled nodes and reuses the current theme and renderer. Ordinary single newlines remain Markdown soft breaks. Under the temporary routing policy, enabling author CSS, JavaScript or extended HTML sends the entire source to native HTML and stops Markdown and ReactiveMD interpretation.
100
100
 
101
101
  Reference a footnote with `[^note]` and define it with `[^note]: Note text`. Continuation paragraphs, lists and code blocks use Markdown indentation. Definitions support Markdown and the basic HTML above. Notes appear at the end in first-reference order; repeated references share a number and each has a return link. Identifiers are case-insensitive and the first duplicate definition wins. Undefined references stay literal; unused definitions stay hidden. Controls and interpolations inside notes remain text and create no bindings or executable expressions.
102
102
 
@@ -0,0 +1,39 @@
1
+ # 0.5.1 预览版发布说明
2
+
3
+ `reactive-md@0.5.1` 是面向 `next` 渠道的 0.x 预览版。语法仍为 `local-draft-2`,组块协议为 `component-protocol-1`,主题协议为 `reactive-md-theme-1`。现有 0.5.x 导入和文档无需迁移。`latest` 仍为 `0.4.0`。
4
+
5
+ ```sh
6
+ npm install reactive-md@next
7
+ # 或固定预览版
8
+ npm install reactive-md@0.5.1
9
+ ```
10
+
11
+ 离线安装可下载 [npm 安装包](https://registry.npmjs.org/reactive-md/-/reactive-md-0.5.1.tgz)。
12
+
13
+ ## 编辑器视图与主题
14
+
15
+ `ReactiveMarkdownEditor` 在编辑区下方新增底栏,显示 Unicode 字数和键盘提示,并提供编辑、并排和预览三种视图。传入 `preview` 后,宿主内容会渲染在编辑器框架内;`viewMode` 和 `onViewModeChange` 用于受控切换,`defaultViewMode` 设置非受控实例的初始视图。切换视图会保留源码选区、撤销记录和预览组件的状态。
16
+
17
+ 容器宽度不超过 600px 时只提供编辑和预览。仅编辑源码的实例保留字数和键盘提示。在源码中先按 Esc 再按 Tab 可把焦点移到工具栏。
18
+
19
+ 编辑区、行号、语法高亮、工具栏和菜单跟随实例主题。浅色模式使用白色编辑区,深色模式保留深蓝底色,`auto` 跟随系统设置。宿主页面主题与编辑器主题相互独立。
20
+
21
+ 完整属性表和视图行为见 [React 源码编辑器](editor-ch.md)。
22
+
23
+ ## HTML 兼容
24
+
25
+ 默认渲染器新增 P0 HTML 子集,包括富文本折叠、容器、标题、代码、列表、链接和图片。宿主可额外开启作者 CSS、JavaScript 和扩展 HTML;三个选项默认全部关闭。任意开启一个,整篇文档分流到隔离的原生 HTML 路径,该路径停止解析 Markdown 和 ReactiveMD。
26
+
27
+ 这项分流是下一版本前的暂时策略。静态导出禁用作者 JavaScript。支持的子集、选项和冲突规则见 [HTML 部分兼容](html-compatibility-ch.md)。
28
+
29
+ ## 兼容性
30
+
31
+ 现有 `reactive-md`、`reactive-md/react`、`reactive-md/editor` 和 `reactive-md/styles.css` 导入保持不变。为 `0.4.x` 和 `0.5.0` 编写的文档无需修改。语法修订、组块协议和主题协议版本不变。
32
+
33
+ 编辑器需要 React 19;核心 `reactive-md` 入口仍不依赖 React。版本轴说明见[变更记录](../CHANGELOG-ch.md)和[版本与兼容性](compatibility-ch.md)。
34
+
35
+ ## 验证与限制
36
+
37
+ 0.5.1 发布门禁覆盖核心与渲染器测试、编辑器入口及其视图、类型检查、包入口、文档链接、离线安装包消费、静态渲染和浏览器交互。CI 使用 Node 22.12 和 24 搭配 Chromium;本机浏览器检查使用 Microsoft Edge。导出 HTML 之外的通用 SSR 水合、Firefox 和 WebKit 尚未验证。
38
+
39
+ 项目仍处于 0.x 预览阶段。安全边界和宿主责任见 [SECURITY-ch.md](../SECURITY-ch.md)。
@@ -0,0 +1,39 @@
1
+ # 0.5.1 preview release
2
+
3
+ `reactive-md@0.5.1` is a 0.x preview that targets the `next` channel. It keeps syntax revision `local-draft-2`, component protocol `component-protocol-1` and theme protocol `reactive-md-theme-1`. Existing 0.5.x imports and documents need no migration. `latest` remains `0.4.0`.
4
+
5
+ ```sh
6
+ npm install reactive-md@next
7
+ # or pin the preview
8
+ npm install reactive-md@0.5.1
9
+ ```
10
+
11
+ For offline installation, use the [npm tarball](https://registry.npmjs.org/reactive-md/-/reactive-md-0.5.1.tgz).
12
+
13
+ ## Editor views and themes
14
+
15
+ `ReactiveMarkdownEditor` adds a status bar below the editing area. It shows the Unicode character count and a keyboard hint, and switches between Edit, Split and Preview. Pass `preview` to render host content inside the editor frame; `viewMode` and `onViewModeChange` control the mode from the host, while `defaultViewMode` sets the initial mode for an uncontrolled instance. Switching views keeps the source selection, undo history and preview component state.
16
+
17
+ Containers up to 600px wide offer only Edit and Preview. A source-only editor keeps the count and keyboard hint. Press Esc, then Tab in the source to move focus to the toolbar.
18
+
19
+ The editor source surface, gutter, syntax highlighting, toolbar and menus now follow the instance theme. Light mode uses a white editor surface, dark mode keeps the deep blue surface, and `auto` follows the system preference. The host page theme and the editor theme remain independent.
20
+
21
+ See [React source editor](editor-en.md) for the full prop table and view behavior.
22
+
23
+ ## HTML compatibility
24
+
25
+ The default renderer now accepts a P0 HTML subset, including disclosures, containers, headings, code, lists, links and images. Three host-owned options add author CSS, JavaScript and extended HTML. All three are off by default. Enabling any one routes the whole document to isolated native HTML, which stops Markdown and ReactiveMD interpretation for that path.
26
+
27
+ This routing is a temporary policy for the next release. Static export disables author JavaScript. See [HTML compatibility](html-compatibility-en.md) for the supported subset, options and conflict rules.
28
+
29
+ ## Compatibility
30
+
31
+ Existing `reactive-md`, `reactive-md/react`, `reactive-md/editor` and `reactive-md/styles.css` imports keep working. Documents written for `0.4.x` and `0.5.0` need no edit. The syntax revision, component protocol and theme protocol keep their current versions.
32
+
33
+ The editor requires React 19. The core `reactive-md` entry still does not depend on React. See the [changelog](../CHANGELOG.md) and [Versions and compatibility](compatibility-en.md) for the version axes.
34
+
35
+ ## Validation and limits
36
+
37
+ The 0.5.1 release gate covers core and renderer tests, the editor entry and its views, type checking, package exports, documentation links, offline tarball consumers, static rendering and browser interaction. CI targets Node 22.12 and 24 with Chromium; local browser checks use Microsoft Edge. General SSR hydration outside exported HTML, Firefox and WebKit remain unverified.
38
+
39
+ The project remains a 0.x preview. Security boundaries and host responsibilities are documented in [SECURITY.md](../SECURITY.md).
@@ -1,19 +1,19 @@
1
1
  # 发布清单
2
2
 
3
- 本文件是维护者的手动发布流程。本清单覆盖 `0.5.0` 预览版,目标渠道为 `next`,`latest` 仍为 `0.4.0`。版本规则见[版本与兼容性](compatibility-ch.md),面向使用者的说明见[0.5.0 发布说明](release-0.5.0-ch.md)。
3
+ 本文件是维护者的手动发布流程。本清单覆盖 `0.5.1` 预览版,目标渠道为 `next`,`latest` 仍为 `0.4.0`。版本规则见[版本与兼容性](compatibility-ch.md),面向使用者的说明见[0.5.1 发布说明](release-0.5.1-ch.md)。
4
4
 
5
5
  ## 发布前确认
6
6
 
7
7
  ### 包身份与元数据
8
8
 
9
- 非 scope 名称 `reactive-md` 已由已发布的 `0.3.0`、`0.3.1` 建立,`reactive-md/react` 和 `reactive-md/styles.css` 子路径也随这些版本生效。`0.5.0` 新增 `reactive-md/editor` 和 `reactive-md/editor/styles.css`。不要把改名当作常规发布准备:改名会破坏导入、状态工具和文档。
9
+ 非 scope 名称 `reactive-md` 已由已发布的 `0.3.0`、`0.3.1` 建立,`reactive-md/react` 和 `reactive-md/styles.css` 子路径也随这些版本生效。`0.5.0` 新增 `reactive-md/editor` 和 `reactive-md/editor/styles.css`,`0.5.1` 保持这些入口。不要把改名当作常规发布准备:改名会破坏导入、状态工具和文档。
10
10
 
11
11
  1. 除非维护者明确决定改用 scope,否则保持 `reactive-md`。scope 需要对应的 npm 账号或组织权限。
12
12
  2. 如果改名,同时更新 `package.json` 的 `name`、文档中的导入语句、tarball 文件名说明、示例和相关子路径,并在变更记录中按破坏性变更说明。
13
13
  3. 核对 `package.json` 的 `repository`、`homepage`、`bugs`、`license`、`engines` 等发布元数据;当前已设置,发布前确认 URL 和最低 Node 版本仍然正确,并确认 `private` 保持移除状态。
14
14
  4. 确认 `files` 覆盖发布所需内容。当前包含 `dist-library`、`dist-standalone`、`bin`、`cli`、README(`README.md`、`README-en.md`、`README-ch.md`)、中英文贡献指南、变更记录与安全策略、`THIRD_PARTY_NOTICES.md`、`docs` 和 `examples`;新增文档或 notice 时同步加入 `files`。
15
15
 
16
- 包名和版本决定 tarball 名称。当前 `0.5.0` 的预期文件名是 `reactive-md-0.5.0.tgz`;改名或改版本后以 `npm pack` 的实际输出为准。
16
+ 包名和版本决定 tarball 名称。当前 `0.5.1` 的预期文件名是 `reactive-md-0.5.1.tgz`;改名或改版本后以 `npm pack` 的实际输出为准。
17
17
 
18
18
  ### 第三方 notice
19
19
 
@@ -51,7 +51,7 @@ npm pack
51
51
  mkdir /tmp/reactive-md-consumer
52
52
  cd /tmp/reactive-md-consumer
53
53
  npm init -y
54
- npm install /path/to/reactive-md-0.5.0.tgz
54
+ npm install /path/to/reactive-md-0.5.1.tgz
55
55
  ```
56
56
 
57
57
  核心入口可在 Node 中直接检查:
@@ -96,12 +96,12 @@ import 'reactive-md/editor/styles.css';
96
96
 
97
97
  1. 确认工作区干净,变更已审查;`npm ci` 从锁文件安装成功。
98
98
  2. 在 Node 22.12 和受支持的较新 LTS(当前为 24)上运行 `npm run verify:release`。这是维护者和 CI 共用的完整门禁,不要用一组自行挑选的命令代替。
99
- 3. 确认版本号、`CHANGELOG-ch.md` 和发布说明一致。`0.5.0` 新增编辑器入口,但 `LOCAL_SYNTAX_VERSION`、组块协议和主题协议修订不变。仅在某条版本轴自身的契约变化时更新它。
99
+ 3. 确认版本号、`CHANGELOG-ch.md` 和发布说明一致。`0.5.1` 保持编辑器入口,但 `LOCAL_SYNTAX_VERSION`、组块协议和主题协议修订不变。仅在某条版本轴自身的契约变化时更新它。
100
100
  4. 检查门禁保留的安装包,包括文件列表、大小和许可文件。手动重新运行 `npm pack` 会产生新候选包,需要单独完成安装验证。
101
101
  5. 核对安装包的 SHA256 与 `artifacts/release-package/package-verification.json` 一致,并记录到发布说明或内部发布记录。
102
102
  6. 合并发布提交,等待 `main` 上的 CI 全部通过。
103
- 7. 手动创建并推送 tag,例如 `v0.5.0`。不要在自动发布工作流中保存 npm token。
104
- 8. 在维护者本机完成 npm 登录和双因素认证后,手动发布已经验证的预览版安装包:`npm publish artifacts/release-package/reactive-md-0.5.0.tgz --access public --tag next`。预览版先发布到 `next`,本次 `latest` 保持 `0.4.0`。提升 `0.5.0` 需要单独决定:`npm dist-tag add reactive-md@0.5.0 latest`。
103
+ 7. 手动创建并推送 tag,例如 `v0.5.1`。不要在自动发布工作流中保存 npm token。
104
+ 8. 在维护者本机完成 npm 登录和双因素认证后,手动发布已经验证的预览版安装包:`npm publish artifacts/release-package/reactive-md-0.5.1.tgz --access public --tag next`。预览版先发布到 `next`,本次 `latest` 保持 `0.4.0`。提升 `0.5.1` 需要单独决定:`npm dist-tag add reactive-md@0.5.1 latest`。
105
105
  9. 在 npm 和 GitHub Releases 上核对包内容、版本、README、许可与发布说明;从公开 registry 重新安装一次。
106
106
  10. 从 registry 验证 README 中的安装命令可用,核对 registry 的完整性摘要与发布 tarball 一致。
107
107
 
@@ -1,19 +1,19 @@
1
1
  # Release checklist
2
2
 
3
- This file is the maintainers' manual release process. This checklist covers the `0.5.0` preview release, which targets the `next` channel; `latest` remains `0.4.0`. See [Versions and compatibility](compatibility-en.md) for version rules and [0.5.0 release notes](release-0.5.0-en.md) for the user-facing summary.
3
+ This file is the maintainers' manual release process. This checklist covers the `0.5.1` preview release, which targets the `next` channel; `latest` remains `0.4.0`. See [Versions and compatibility](compatibility-en.md) for version rules and [0.5.1 release notes](release-0.5.1-en.md) for the user-facing summary.
4
4
 
5
5
  ## Before release
6
6
 
7
7
  ### Package identity and metadata
8
8
 
9
- The unscoped name `reactive-md` is already established by the published `0.3.0` and `0.3.1` releases, together with the `reactive-md/react` and `reactive-md/styles.css` subpaths. `0.5.0` adds `reactive-md/editor` and `reactive-md/editor/styles.css`. Do not treat a rename as routine release preparation: changing the name is a breaking change for imports, state tooling and documentation.
9
+ The unscoped name `reactive-md` is already established by the published `0.3.0` and `0.3.1` releases, together with the `reactive-md/react` and `reactive-md/styles.css` subpaths. `0.5.0` adds `reactive-md/editor` and `reactive-md/editor/styles.css`; `0.5.1` keeps those entries. Do not treat a rename as routine release preparation: changing the name is a breaking change for imports, state tooling and documentation.
10
10
 
11
11
  1. Keep `reactive-md` unless maintainers explicitly decide on a scoped rename. A scope requires the corresponding npm account or organization permissions.
12
12
  2. If renaming, update `name` in `package.json`, import statements in the documentation, tarball filename references, examples and the relevant subpaths, then record the change as breaking in the changelog.
13
13
  3. Check release metadata in `package.json`: `repository`, `homepage`, `bugs`, `license`, `engines` and similar fields. They are currently set; before releasing, confirm the URLs and minimum Node version are still correct and that `private` remains removed.
14
14
  4. Confirm `files` covers what needs to be published. It currently includes `dist-library`, `dist-standalone`, `bin`, `cli`, the READMEs (`README.md`, `README-en.md`, `README-ch.md`), the contributing, changelog and security guides in both languages, `THIRD_PARTY_NOTICES.md`, `docs` and `examples`; add any new documentation or notices to `files` as well.
15
15
 
16
- The package name and version determine the tarball name. The expected filename for `0.5.0` is `reactive-md-0.5.0.tgz`; after renaming or changing the version, use the actual output of `npm pack`.
16
+ The package name and version determine the tarball name. The expected filename for `0.5.1` is `reactive-md-0.5.1.tgz`; after renaming or changing the version, use the actual output of `npm pack`.
17
17
 
18
18
  ### Third-party notices
19
19
 
@@ -51,7 +51,7 @@ npm pack
51
51
  mkdir /tmp/reactive-md-consumer
52
52
  cd /tmp/reactive-md-consumer
53
53
  npm init -y
54
- npm install /path/to/reactive-md-0.5.0.tgz
54
+ npm install /path/to/reactive-md-0.5.1.tgz
55
55
  ```
56
56
 
57
57
  The core entry can be checked directly in Node:
@@ -86,7 +86,7 @@ Release notes are for users and must include at least:
86
86
 
87
87
  - The package version, `LOCAL_SYNTAX_VERSION`, component protocol revision and theme protocol revision; these are different version numbers.
88
88
  - The install command `npm install reactive-md@next`, or `npm install reactive-md@<version>` to pin the release, with a downloadable tarball as an offline installation option.
89
- - User-visible changes, breaking changes and migration steps; link directly to the [changelog](../CHANGELOG.md) and the [0.5.0 release notes](release-0.5.0-en.md) for this cycle.
89
+ - User-visible changes, breaking changes and migration steps; link directly to the [changelog](../CHANGELOG.md) and the [0.5.1 release notes](release-0.5.1-en.md) for this cycle.
90
90
  - Verified platforms, plus unverified browsers, general SSR hydration and other scope.
91
91
  - Known limitations and a link to [SECURITY.md](../SECURITY.md).
92
92
 
@@ -96,12 +96,12 @@ Do not write results for checks that have not run, and do not present the existe
96
96
 
97
97
  1. Confirm the working tree is clean, changes have been reviewed, and `npm ci` installs successfully from the lockfile.
98
98
  2. On Node 22.12 and a supported newer LTS (currently 24), run `npm run verify:release`. This is the same complete gate local maintainers and CI use; do not replace it with a list of hand-picked commands.
99
- 3. Confirm the version number, `CHANGELOG.md` and the release notes agree. `0.5.0` adds the editor entry but keeps `LOCAL_SYNTAX_VERSION` and the component and theme protocol revisions. Update a version axis only when its own contract changes.
99
+ 3. Confirm the version number, `CHANGELOG.md` and the release notes agree. `0.5.1` keeps the editor entry but keeps `LOCAL_SYNTAX_VERSION` and the component and theme protocol revisions. Update a version axis only when its own contract changes.
100
100
  4. Inspect the verified archive retained by the gate, including its file list, size and license files. A fresh manual `npm pack` produces a new candidate that needs its own installation verification.
101
101
  5. Compare the archive's SHA256 with `artifacts/release-package/package-verification.json` and record it in the release notes or an internal release record.
102
102
  6. Merge the release commit and wait for all CI on `main` to pass.
103
- 7. Create and push the tag manually, for example `v0.5.0`. Do not store npm tokens in an automated release workflow.
104
- 8. After signing in to npm and completing two-factor authentication on the maintainer's machine, publish the verified preview tarball manually: `npm publish artifacts/release-package/reactive-md-0.5.0.tgz --access public --tag next`. Preview releases start on `next`, and this release keeps `latest` on `0.4.0`. Promoting `0.5.0` requires a separate decision: `npm dist-tag add reactive-md@0.5.0 latest`.
103
+ 7. Create and push the tag manually, for example `v0.5.1`. Do not store npm tokens in an automated release workflow.
104
+ 8. After signing in to npm and completing two-factor authentication on the maintainer's machine, publish the verified preview tarball manually: `npm publish artifacts/release-package/reactive-md-0.5.1.tgz --access public --tag next`. Preview releases start on `next`, and this release keeps `latest` on `0.4.0`. Promoting `0.5.1` requires a separate decision: `npm dist-tag add reactive-md@0.5.1 latest`.
105
105
  9. Verify the package contents, version, README, license and release notes on npm and GitHub Releases; reinstall once from the public registry.
106
106
  10. Verify that the install command in the README works from the registry, and that the registry integrity digest matches the released tarball.
107
107
 
@@ -4,6 +4,8 @@
4
4
 
5
5
  ## 两种产物
6
6
 
7
+ 默认 ReactiveMD 文档遵循下述导出规则。原生 HTML 文档的交互导出保留 `compileOptions` 和整篇 HTML 路径,静态导出禁用作者 JavaScript;这类文档没有 ReactiveMD 参数。编译开关、隔离和暂时性分流政策见 [HTML 部分兼容](html-compatibility-ch.md)。
8
+
7
9
  **交互式 HTML** 是一个自包含的 `.html` 文件。它内嵌原始源码、独立浏览器运行时、React 19、样式表和打印样式。读者通过 `file://` 打开即可交互,不需要 Node.js、React、reactive-md 包或网络连接。
8
10
 
9
11
  首次渲染是静态内容;内嵌运行时水合完成后再增强为控件。禁用 JavaScript 时,正文、当前值、表格、公式和图表仍然可读。读者刷新后回到导出基线,后续修改不会自动保存。
@@ -4,6 +4,8 @@ This guide covers the single-file HTML exporter introduced with `local-draft-2`.
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.
8
+
7
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.
8
10
 
9
11
  The first rendered pass is static. After the embedded runtime hydrates it, controls become interactive. With JavaScript disabled the same static values, tables, formulas and charts remain readable. Refreshing restores the exported baseline; the reader's changes are not persisted.
@@ -4,6 +4,8 @@ These are standalone authoring examples for `local-draft-2`, described in the [l
4
4
 
5
5
  The original eleven working examples and one intentionally broken diagnostics document remain in this directory, with Chinese versions in [zh/](zh/). The six feature tours live in [showcase/](showcase/README.md), with Chinese sources in [showcase/zh/](showcase/zh/). Each file runs independently. Controls, expressions and visualizations use local state.
6
6
 
7
+ The new [HTML compatibility example](html-compat.reactive.md) combines rich disclosures, Markdown and a bound counter. See the [temporary HTML routing policy](../../docs/html-compatibility-en.md) before enabling author CSS, JavaScript or extended HTML.
8
+
7
9
  ## Start with the short examples
8
10
 
9
11
  The [workshop recipe](recipes/workshop.reactive.md) ([中文](recipes/workshop-zh.reactive.md)) combines cross-field validation, conditional tones, numeric aggregates and generated table rows. See the [constraints and collections reference](../../docs/constraints-collections-en.md) for rules and budgets.
@@ -0,0 +1,24 @@
1
+ # HTML 与 ReactiveMD
2
+
3
+ <details open>
4
+ <summary>展开查看<strong>交互示例</strong></summary>
5
+
6
+ ## 调整参数
7
+
8
+ <counter bind="count" label="次数" initial="2">
9
+
10
+ 当前值:**{{ count }}**。HTML 上下标:H<sub>2</sub>O、x<sup>2</sup>。
11
+
12
+ <details>
13
+ <summary>补充说明</summary>
14
+
15
+ 折叠正文支持 Markdown、公式与 ReactiveMD 控件。
16
+
17
+ </details>
18
+ </details>
19
+
20
+ <blockquote>默认模式使用现有渲染器和主题。</blockquote>
21
+
22
+ <ol start="3"><li>支持 HTML 列表。</li><li>代码按原样显示。</li></ol>
23
+
24
+ <pre><code>&lt;counter label="这里是代码"&gt; {{ count }}</code></pre>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactive-md",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Author interactive local documents in Markdown, with expression-bound inputs, charts and diagrams.",
5
5
  "keywords": [
6
6
  "markdown",
@@ -75,6 +75,7 @@
75
75
  "test:date-browser": "node scripts/verify-date-input-browser.mjs",
76
76
  "test:editor-browser": "node scripts/verify-editor-browser.mjs",
77
77
  "test:markdown-browser": "node scripts/verify-markdown-browser.mjs",
78
+ "test:html-browser": "node scripts/verify-html-compat-browser.mjs",
78
79
  "test:media-browser": "node scripts/verify-media-browser.mjs",
79
80
  "test:computations-browser": "node scripts/verify-computations-browser.mjs",
80
81
  "test:constraints-browser": "node scripts/verify-constraints-browser.mjs",
@@ -121,6 +122,7 @@
121
122
  "@types/react": "19.3.0",
122
123
  "@types/react-dom": "19.3.0",
123
124
  "lowlight": "3.3.0",
125
+ "parse5": "8.0.1",
124
126
  "react": "19.3.1",
125
127
  "react-dom": "19.3.1",
126
128
  "remark-gfm": "4.0.1",