reactive-md 0.4.1 → 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 (98) hide show
  1. package/CHANGELOG-ch.md +144 -113
  2. package/CHANGELOG.md +144 -113
  3. package/LICENSE +21 -21
  4. package/README-ch.md +154 -123
  5. package/README-en.md +179 -147
  6. package/README.md +179 -147
  7. package/SECURITY-ch.md +4 -3
  8. package/SECURITY.md +4 -3
  9. package/THIRD_PARTY_NOTICES.md +138 -1
  10. package/bin/reactive-md.mjs +1 -1
  11. package/dist-library/reactive-md-editor.css +2 -0
  12. package/dist-library/reactive-md-editor.js +3834 -0
  13. package/dist-library/reactive-md-react.js +9324 -1670
  14. package/dist-library/reactive-md.css +1 -1
  15. package/dist-library/reactive-md.js +426 -305
  16. package/dist-library/{runtime-D3QTVYaz.js → runtime-CXBdLQ3A.js} +8950 -2895
  17. package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +7 -0
  18. package/dist-library/types/editor/editor-commands.d.ts +50 -0
  19. package/dist-library/types/editor/editor-i18n.d.ts +109 -0
  20. package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
  21. package/dist-library/types/editor/editor-view-bar.d.ts +11 -0
  22. package/dist-library/types/editor/extended-native-components.d.ts +58 -0
  23. package/dist-library/types/editor/index.d.ts +9 -0
  24. package/dist-library/types/editor/locale.d.ts +13 -0
  25. package/dist-library/types/editor/native-components.d.ts +47 -0
  26. package/dist-library/types/editor/source-authoring.d.ts +57 -0
  27. package/dist-library/types/editor/types.d.ts +51 -0
  28. package/dist-library/types/editor/use-gutter-metrics.d.ts +5 -0
  29. package/dist-library/types/editor/use-source-history.d.ts +16 -0
  30. package/dist-library/types/local/LocalDocumentView.d.ts +10 -3
  31. package/dist-library/types/local/code-block.d.ts +26 -0
  32. package/dist-library/types/local/diagnostics.d.ts +25 -0
  33. package/dist-library/types/local/footnotes.d.ts +51 -0
  34. package/dist-library/types/local/heading-anchors.d.ts +2 -0
  35. package/dist-library/types/local/html.d.ts +16 -0
  36. package/dist-library/types/local/image-view.d.ts +23 -0
  37. package/dist-library/types/local/index.d.ts +1 -1
  38. package/dist-library/types/local/options.d.ts +29 -0
  39. package/dist-library/types/local/types.d.ts +42 -1
  40. package/dist-library/types/local/worker.d.ts +18 -6
  41. package/dist-library/types/shareable.d.ts +9 -1
  42. package/dist-standalone/reactive-md-standalone.css +1 -1
  43. package/dist-standalone/reactive-md-standalone.js +49 -38
  44. package/docs/compatibility-ch.md +12 -8
  45. package/docs/compatibility-en.md +12 -8
  46. package/docs/component-protocol-ch.md +2 -2
  47. package/docs/component-protocol-en.md +2 -2
  48. package/docs/editor-ch.md +235 -0
  49. package/docs/editor-en.md +235 -0
  50. package/docs/html-compatibility-ch.md +98 -0
  51. package/docs/html-compatibility-en.md +98 -0
  52. package/docs/local-guide-ch.md +11 -5
  53. package/docs/local-guide-en.md +11 -5
  54. package/docs/local-integration-ch.md +4 -1
  55. package/docs/local-integration-en.md +4 -1
  56. package/docs/local-interaction-syntax-ch.md +9 -2
  57. package/docs/local-interaction-syntax-en.md +7 -2
  58. package/docs/release-0.4.1-ch.md +23 -23
  59. package/docs/release-0.4.1-en.md +23 -23
  60. package/docs/release-0.5.0-ch.md +41 -0
  61. package/docs/release-0.5.0-en.md +41 -0
  62. package/docs/release-0.5.1-ch.md +39 -0
  63. package/docs/release-0.5.1-en.md +39 -0
  64. package/docs/releasing-ch.md +108 -101
  65. package/docs/releasing-en.md +108 -101
  66. package/docs/shareable-export-ch.md +6 -2
  67. package/docs/shareable-export-en.md +6 -2
  68. package/examples/integration/core/package.json +7 -7
  69. package/examples/integration/react/index.html +12 -12
  70. package/examples/integration/react/main.jsx +21 -21
  71. package/examples/integration/react/package.json +9 -9
  72. package/examples/integration/react-editor.tsx +74 -0
  73. package/examples/local/README.md +2 -0
  74. package/examples/local/catalog.reactive.md +20 -20
  75. package/examples/local/checklist.reactive.md +32 -32
  76. package/examples/local/comparison.reactive.md +47 -47
  77. package/examples/local/components.reactive.md +44 -44
  78. package/examples/local/counter.reactive.md +7 -7
  79. package/examples/local/diagnostics.reactive.md +54 -54
  80. package/examples/local/diagram.reactive.md +44 -44
  81. package/examples/local/gallery.reactive.md +61 -61
  82. package/examples/local/html-compat.reactive.md +24 -0
  83. package/examples/local/parameters.reactive.md +36 -36
  84. package/examples/local/planning.reactive.md +24 -24
  85. package/examples/local/pricing.reactive.md +20 -20
  86. package/examples/local/zh/catalog.reactive.md +20 -20
  87. package/examples/local/zh/charts.reactive.md +73 -73
  88. package/examples/local/zh/checklist.reactive.md +32 -32
  89. package/examples/local/zh/comparison.reactive.md +47 -47
  90. package/examples/local/zh/components.reactive.md +44 -44
  91. package/examples/local/zh/counter.reactive.md +7 -7
  92. package/examples/local/zh/diagnostics.reactive.md +54 -54
  93. package/examples/local/zh/diagram.reactive.md +44 -44
  94. package/examples/local/zh/gallery.reactive.md +61 -61
  95. package/examples/local/zh/parameters.reactive.md +36 -36
  96. package/examples/local/zh/planning.reactive.md +24 -24
  97. package/examples/local/zh/pricing.reactive.md +20 -20
  98. package/package.json +135 -91
package/README.md CHANGED
@@ -1,147 +1,179 @@
1
- # Reactive MD
2
-
3
- [English](README-en.md) · [中文](README-ch.md)
4
-
5
- Write local interactive documents in Markdown. Add input controls, name parameters with `bind`, and connect prose, formulas, charts and diagrams with `{{ expressions }}`. Document authors do not write JavaScript or CSS.
6
-
7
- Local mode uses HTML-style tags, with parameters and table data written directly in the prose; LaTeX formulas can drive function plots. The TypeScript core and the React renderer can be integrated independently. `0.4.1` is the current 0.x preview on both `latest` and `next`, with syntax revision `local-draft-2`. See [README-ch.md](README-ch.md) for the Chinese overview.
8
-
9
- ## Start here
10
-
11
- - [Beginner guide](docs/local-guide-en.md): move from Markdown to interactive documents, with a complete exercise and an error quick reference.
12
- - [Local interaction syntax specification](docs/local-interaction-syntax-en.md) · [Feature tours and examples](examples/local/README.md): 48 tag names, tags, in-place parameters and LaTeX plots.
13
- - [Local mode integration](docs/local-integration-en.md): `compileLocal`, the state runtime, React embedding, URL policy and style scoping.
14
- - [Shareable documents and static export](docs/shareable-export-en.md): single-file interactive HTML, static output, versioned state files, assets, the CLI and the standalone browser API.
15
- - [Theme protocol](docs/theme-protocol-en.md): document theme selection, custom CSS and light/dark modes.
16
- - [Author tools](docs/author-tools-en.md): source highlighting, completion, binding navigation, rename, formatting and command-line lint.
17
- - [Standalone integration examples](examples/integration/README.md): Node core and React pages you can copy and run outside the repository.
18
- - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, the diagnostics contract and supported platforms.
19
- - [Component protocol](docs/component-protocol-en.md) · [Component development guide](docs/component-development-en.md): declarations, behavior contracts and compatibility acceptance for new components.
20
- - [0.4.1 release notes](docs/release-0.4.1-en.md): visual and interaction fixes, compatible with 0.4.0.
21
- - [0.4.0 release and migration](docs/release-0.4.0-en.md): what the minor series adds and how to upgrade from `0.3.1` / `local-draft-1`.
22
-
23
- ## Write a document
24
-
25
- ```markdown
26
- <panel title="Cost estimate">
27
- <slider bind="people" label="People" initial="2" min="1" max="20">
28
- <toggle bind="annual" label="Annual billing">
29
- </panel>
30
-
31
- Monthly cost: **{{ people * (annual ? 80 : 100) }} USD**.
32
- ```
33
-
34
- Inputs update the result immediately, and the panel includes a restore-defaults action. A standalone counter is a single line: `<counter label="People">`.
35
-
36
- `0.4.0` adds `local-draft-2`, named calculations, validation, collections, themes and offline HTML export. The earlier `0.3.1` release uses `local-draft-1`. See [0.4.0 release and migration](docs/release-0.4.0-en.md).
37
-
38
- ## Install
39
-
40
- Reactive MD requires Node.js 22.12 or newer and ships only ESM entries:
41
-
42
- ```sh
43
- npm install reactive-md
44
- ```
45
-
46
- Both `latest` and `next` resolve to `0.4.1`; pin it with `npm install reactive-md@0.4.1`. Read the migration guide before upgrading from `0.3.1` / `local-draft-1`.
47
-
48
- The `reactive-md` entry provides the local compiler, expressions and runtime; `reactive-md/react` provides the React renderer. Import component styles from `reactive-md/styles.css`.
49
-
50
- The core `reactive-md` entry does not depend on React:
51
-
52
- ```js
53
- import { compileLocal, createLocalRuntime } from 'reactive-md';
54
-
55
- const result = compileLocal('<number bind="n" label="Count" initial="2">');
56
- if (result.ok) {
57
- const runtime = createLocalRuntime(result.document);
58
- try { console.log(runtime.text('Total: {{ n * 100 }}')); }
59
- finally { runtime.dispose(); }
60
- }
61
- ```
62
-
63
- See [Local mode integration](docs/local-integration-en.md) for the full compile and runtime APIs, host URL policy, lifecycle and style overrides.
64
-
65
- 0.x minor releases may contain breaking changes. Before upgrading, read the [changelog](CHANGELOG.md) and [compatibility rules](docs/compatibility-en.md), and keep the original `.reactive.md` sources.
66
-
67
- ## Use with React
68
-
69
- The React entry requires React 19:
70
-
71
- ```sh
72
- npm install react@19 react-dom@19
73
- ```
74
-
75
- ```tsx
76
- import { LocalReactiveDocument } from 'reactive-md/react';
77
- import 'reactive-md/styles.css';
78
-
79
- export function Article({ source }: { source: string }) {
80
- return <LocalReactiveDocument source={source} />;
81
- }
82
- ```
83
-
84
- `LocalReactiveDocument` compiles and manages the runtime for you. To control compilation, lifecycle or URL policy yourself, use `LocalDocumentView` as described in [Local mode integration](docs/local-integration-en.md).
85
-
86
- ## Share documents
87
-
88
- Build a self-contained HTML file that readers can open offline, or a script-free static snapshot:
89
-
90
- ```sh
91
- npm run build
92
- npx reactive-md build examples/local/counter.reactive.md -o counter.html
93
- npx reactive-md build examples/local/counter.reactive.md -o counter-static.html --mode static
94
- ```
95
-
96
- The interactive file embeds the original source, React 19, the runtime, styles and any verified local images. It hydrates a static first screen, so it remains readable with JavaScript disabled. Use `--state-file doc.state.json` to export a saved `reactive-md-state/v1` baseline; without it, the author initial values are used and become the reader's reset baseline. The demo export dialog can save the current preview parameters as such a file.
97
-
98
- See [Shareable documents and static export](docs/shareable-export-en.md) for image limits, CSP/security, printing, exit codes, `ReactiveMD.mount`/`mountAll` and `<reactive-md-doc>`.
99
-
100
- ## Try the demo
101
-
102
- ```sh
103
- npm ci
104
- npm run dev
105
- ```
106
-
107
- The command builds the language package first, then starts the standalone `demo/` app at `http://127.0.0.1:5173`. `/embed.html` demonstrates the embedding approach. The masthead language toggle switches the demo between English and Chinese, and the choice is saved in the browser. The demo pages, editor, demo server, assets and browser checks all live in `demo/` and integrate through the package's public entries.
108
-
109
- ## Repository layout
110
-
111
- ```text
112
- src/ Local syntax compilation, expressions, runtime and React renderer
113
- examples/ Copyable local interactive examples, independent of the demo app
114
- docs/ Local syntax specification, integration and release documentation
115
- tests/ Language and renderer tests
116
- demo/ Standalone Playground app
117
- ```
118
-
119
- ## Documentation
120
-
121
- - [Beginner guide](docs/local-guide-en.md) and [local interaction syntax specification](docs/local-interaction-syntax-en.md).
122
- - [Local mode integration](docs/local-integration-en.md): core and React API, URL policy, lifecycle, styling and version pinning.
123
- - [Shareable documents and static export](docs/shareable-export-en.md): CLI build/lint, state files, local image inlining, printing and the standalone browser runtime.
124
- - [Feature tours and examples](examples/local/README.md) and [standalone integrations](examples/integration/README.md).
125
- - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, diagnostics and supported platforms.
126
- - [0.4.0 release and migration](docs/release-0.4.0-en.md): the upgrade checklist for this release.
127
- - [Component protocol](docs/component-protocol-en.md) and [component development guide](docs/component-development-en.md): contribution contracts, a proposal template and acceptance cases.
128
- - [Performance measurements](docs/performance-en.md) and [release checklist](docs/releasing-en.md).
129
-
130
- See the [contributing guide](CONTRIBUTING.md) for development and test commands.
131
-
132
- ## Support and status
133
-
134
- - CI targets Node 22.12 and Node 24 with Playwright Chromium; local browser checks use Microsoft Edge. The packed check covers static SSR, and `npm run test:shareable` covers the single-file export's static-first hydration. General SSR hydration outside that path, Firefox and WebKit remain unverified.
135
- - 0.x minor releases may contain breaking changes. Persist the original `.reactive.md` source, not the runtime AST or in-memory state.
136
- - `0.4.1` is available on both `latest` and `next`. Security fixes may ship in minor releases.
137
-
138
- ## Contributing and security
139
-
140
- - [Contributing guide](CONTRIBUTING.md): environment, check commands and change requirements.
141
- - [Security policy](SECURITY.md): threat boundary, resource limits, host responsibilities and vulnerability reporting.
142
- - [Changelog](CHANGELOG.md).
143
- - [Release checklist](docs/releasing-en.md): the verification gate, notices, tarball and the manual release flow for maintainers.
144
-
145
- ## License
146
-
147
- [MIT](LICENSE)
1
+ # Reactive MD
2
+
3
+ [English](README-en.md) · [中文](README-ch.md)
4
+
5
+ Write local interactive documents in Markdown. Add input controls, name parameters with `bind`, and connect prose, formulas, charts and diagrams with `{{ expressions }}`. Document authors do not write JavaScript or CSS.
6
+
7
+ Local mode uses HTML-style tags, with parameters and table data written directly in the prose; LaTeX formulas can drive function plots. The TypeScript core and the React renderer can be integrated independently. `0.5.1` is the preview for the `next` channel and adds the `reactive-md/editor` source editor; `latest` remains `0.4.0`. Syntax revision stays `local-draft-2`. See [README-ch.md](README-ch.md) for the Chinese overview.
8
+
9
+ ## Start here
10
+
11
+ - [Beginner guide](docs/local-guide-en.md): move from Markdown to interactive documents, with a complete exercise and an error quick reference.
12
+ - [Local interaction syntax specification](docs/local-interaction-syntax-en.md) · [Feature tours and examples](examples/local/README.md): 48 tag names, tags, in-place parameters and LaTeX plots.
13
+ - [Local mode integration](docs/local-integration-en.md): `compileLocal`, the state runtime, React embedding, URL policy and style scoping.
14
+ - [HTML compatibility](docs/html-compatibility-en.md): P0 HTML and the next release's temporary routing policy for author CSS, JavaScript and extended HTML.
15
+ - [Shareable documents and static export](docs/shareable-export-en.md): single-file interactive HTML, static output, versioned state files, assets, the CLI and the standalone browser API.
16
+ - [Theme protocol](docs/theme-protocol-en.md): document theme selection, custom CSS and light/dark modes.
17
+ - [Author tools](docs/author-tools-en.md): source highlighting, completion, binding navigation, rename, formatting and command-line lint.
18
+ - [React source editor](docs/editor-en.md): controlled editor, props, ref handle, diagnostics, locale, theme and history.
19
+ - [Standalone integration examples](examples/integration/README.md): Node core and React pages you can copy and run outside the repository.
20
+ - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, the diagnostics contract and supported platforms.
21
+ - [Component protocol](docs/component-protocol-en.md) · [Component development guide](docs/component-development-en.md): declarations, behavior contracts and compatibility acceptance for new components.
22
+ - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
23
+ - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
24
+ - [0.4.1 release notes](docs/release-0.4.1-en.md): visual and interaction fixes, compatible with 0.4.0.
25
+ - [0.4.0 release and migration](docs/release-0.4.0-en.md): what the minor series adds and how to upgrade from `0.3.1` / `local-draft-1`.
26
+
27
+ ## Write a document
28
+
29
+ ```markdown
30
+ <panel title="Cost estimate">
31
+ <slider bind="people" label="People" initial="2" min="1" max="20">
32
+ <toggle bind="annual" label="Annual billing">
33
+ </panel>
34
+
35
+ Monthly cost: **{{ people * (annual ? 80 : 100) }} USD**.
36
+ ```
37
+
38
+ Inputs update the result immediately, and the panel includes a restore-defaults action. A standalone counter is a single line: `<counter label="People">`.
39
+
40
+ `0.4.0` adds `local-draft-2`, named calculations, validation, collections, themes and offline HTML export. The earlier `0.3.1` release uses `local-draft-1`. See [0.4.0 release and migration](docs/release-0.4.0-en.md).
41
+
42
+ ## Install
43
+
44
+ Reactive MD requires Node.js 22.12 or newer and ships only ESM entries:
45
+
46
+ ```sh
47
+ npm install reactive-md
48
+ ```
49
+
50
+ `latest` resolves to `0.4.0`. The 0.5.1 preview targets `next`:
51
+
52
+ ```sh
53
+ npm install reactive-md@next
54
+ # or pin the preview
55
+ npm install reactive-md@0.5.1
56
+ ```
57
+
58
+ Read the [0.5.1 release notes](docs/release-0.5.1-en.md) before using the preview, and the [migration guide](docs/release-0.4.0-en.md) before upgrading from `0.3.1` / `local-draft-1`.
59
+
60
+ The `reactive-md` entry provides the local compiler, expressions and runtime; `reactive-md/react` provides the React renderer. Import component styles from `reactive-md/styles.css`. The `reactive-md/editor` entry provides the source editor with its own stylesheet at `reactive-md/editor/styles.css`. Existing renderer and style imports are unchanged in 0.5.1.
61
+
62
+ The core `reactive-md` entry does not depend on React:
63
+
64
+ ```js
65
+ import { compileLocal, createLocalRuntime } from 'reactive-md';
66
+
67
+ const result = compileLocal('<number bind="n" label="Count" initial="2">');
68
+ if (result.ok) {
69
+ const runtime = createLocalRuntime(result.document);
70
+ try { console.log(runtime.text('Total: {{ n * 100 }}')); }
71
+ finally { runtime.dispose(); }
72
+ }
73
+ ```
74
+
75
+ See [Local mode integration](docs/local-integration-en.md) for the full compile and runtime APIs, host URL policy, lifecycle and style overrides.
76
+
77
+ 0.x minor releases may contain breaking changes. Before upgrading, read the [changelog](CHANGELOG.md) and [compatibility rules](docs/compatibility-en.md), and keep the original `.reactive.md` sources.
78
+
79
+ ## Use with React
80
+
81
+ The React entry requires React 19:
82
+
83
+ ```sh
84
+ npm install react@19 react-dom@19
85
+ ```
86
+
87
+ ```tsx
88
+ import { LocalReactiveDocument } from 'reactive-md/react';
89
+ import 'reactive-md/styles.css';
90
+
91
+ export function Article({ source }: { source: string }) {
92
+ return <LocalReactiveDocument source={source} />;
93
+ }
94
+ ```
95
+
96
+ `LocalReactiveDocument` compiles and manages the runtime for you. To control compilation, lifecycle or URL policy yourself, use `LocalDocumentView` as described in [Local mode integration](docs/local-integration-en.md).
97
+
98
+ ## Edit source with React
99
+
100
+ The 0.5.x preview adds a reusable source editor at `reactive-md/editor`, with its own stylesheet at `reactive-md/editor/styles.css`. The component is controlled and requires React 19:
101
+
102
+ ```tsx
103
+ import { useState } from 'react';
104
+ import { ReactiveMarkdownEditor } from 'reactive-md/editor';
105
+ import 'reactive-md/editor/styles.css';
106
+
107
+ export function Editor() {
108
+ const [source, setSource] = useState('# Notes');
109
+ return <ReactiveMarkdownEditor value={source} onChange={setSource} />;
110
+ }
111
+ ```
112
+
113
+ The editor handles highlighting, formatting and insertion tools, completion, binding tools, undo and redo, and line numbers. It does not compile or render a preview; keep the source in your app and render it with `reactive-md/react`. See [React source editor](docs/editor-en.md) for the props, ref handle, diagnostics, themes, locales and history.
114
+
115
+ ## Share documents
116
+
117
+ Build a self-contained HTML file that readers can open offline, or a script-free static snapshot:
118
+
119
+ ```sh
120
+ npm run build
121
+ npx reactive-md build examples/local/counter.reactive.md -o counter.html
122
+ npx reactive-md build examples/local/counter.reactive.md -o counter-static.html --mode static
123
+ ```
124
+
125
+ The interactive file embeds the original source, React 19, the runtime, styles and any verified local images. It hydrates a static first screen, so it remains readable with JavaScript disabled. Use `--state-file doc.state.json` to export a saved `reactive-md-state/v1` baseline; without it, the author initial values are used and become the reader's reset baseline. The demo export dialog can save the current preview parameters as such a file.
126
+
127
+ See [Shareable documents and static export](docs/shareable-export-en.md) for image limits, CSP/security, printing, exit codes, `ReactiveMD.mount`/`mountAll` and `<reactive-md-doc>`.
128
+
129
+ ## Try the demo
130
+
131
+ ```sh
132
+ npm ci
133
+ npm run dev
134
+ ```
135
+
136
+ The command builds the language package first, then starts the standalone `demo/` app at `http://127.0.0.1:5173`. `/embed.html` demonstrates the embedding approach. The masthead language toggle switches the demo between English and Chinese, and the choice is saved in the browser. The demo pages, editor, demo server, assets and browser checks all live in `demo/` and integrate through the package's public entries.
137
+
138
+ ## Repository layout
139
+
140
+ ```text
141
+ src/ Local syntax compilation, expressions, runtime and React renderer
142
+ examples/ Copyable local interactive examples, independent of the demo app
143
+ docs/ Local syntax specification, integration and release documentation
144
+ tests/ Language and renderer tests
145
+ demo/ Standalone Playground app
146
+ ```
147
+
148
+ ## Documentation
149
+
150
+ - [Beginner guide](docs/local-guide-en.md) and [local interaction syntax specification](docs/local-interaction-syntax-en.md).
151
+ - [Local mode integration](docs/local-integration-en.md): core and React API, URL policy, lifecycle, styling and version pinning.
152
+ - [Shareable documents and static export](docs/shareable-export-en.md): CLI build/lint, state files, local image inlining, printing and the standalone browser runtime.
153
+ - [Feature tours and examples](examples/local/README.md) and [standalone integrations](examples/integration/README.md).
154
+ - [React source editor](docs/editor-en.md): controlled editor for `.reactive.md` source, with its own stylesheet.
155
+ - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, diagnostics and supported platforms.
156
+ - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
157
+ - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
158
+ - [0.4.0 release and migration](docs/release-0.4.0-en.md): the upgrade checklist for that minor series.
159
+ - [Component protocol](docs/component-protocol-en.md) and [component development guide](docs/component-development-en.md): contribution contracts, a proposal template and acceptance cases.
160
+ - [Performance measurements](docs/performance-en.md) and [release checklist](docs/releasing-en.md).
161
+
162
+ See the [contributing guide](CONTRIBUTING.md) for development and test commands.
163
+
164
+ ## Support and status
165
+
166
+ - CI targets Node 22.12 and Node 24 with Playwright Chromium; local browser checks use Microsoft Edge. The packed check covers static SSR, and `npm run test:shareable` covers the single-file export's static-first hydration. General SSR hydration outside that path, Firefox and WebKit remain unverified.
167
+ - 0.x minor releases may contain breaking changes. Persist the original `.reactive.md` source, not the runtime AST or in-memory state.
168
+ - `latest` is `0.4.0`; the `0.5.1` preview targets `next`. Security fixes may ship in minor releases.
169
+
170
+ ## Contributing and security
171
+
172
+ - [Contributing guide](CONTRIBUTING.md): environment, check commands and change requirements.
173
+ - [Security policy](SECURITY.md): threat boundary, resource limits, host responsibilities and vulnerability reporting.
174
+ - [Changelog](CHANGELOG.md).
175
+ - [Release checklist](docs/releasing-en.md): the verification gate, notices, tarball and the manual release flow for maintainers.
176
+
177
+ ## License
178
+
179
+ [MIT](LICENSE)
package/SECURITY-ch.md CHANGED
@@ -12,8 +12,9 @@ Reactive MD 渲染作者编写的本地交互文档。文档是不可信输入
12
12
 
13
13
  ### 文档内容
14
14
 
15
- - 作者不能执行脚本。`<script>`、原始 HTML、`on-*` 事件属性和作者 CSS 不属于 `local-draft-2`,会作为语法诊断或文本处理,不会作为 HTML 执行。
16
- - React 渲染器不调用 `dangerouslySetInnerHTML`,也不把文档内容写入 `innerHTML`。
15
+ - 三个 HTML 能力开关全部关闭时,作者脚本、事件属性和 CSS 保持惰性。P0 HTML 重建为受控节点和 React 元素。见 [HTML 部分兼容与暂时性分流政策](docs/html-compatibility-ch.md)。
16
+ - 开启 `enableCss`、`enableJavaScript` 或 `enableExtendedHtml` 中任意一个,整篇源码会在不带 `allow-same-origin` 的沙箱 iframe 中按原生 HTML 处理。其他开关继续约束作者源码;允许任意 JavaScript 后,脚本可以动态创建元素和样式,源码开关不构成运行时 DOM 权限。网络、表单和导航继续受 CSP 与沙箱限制。
17
+ - 默认 React 渲染器不调用 `dangerouslySetInnerHTML`,也不把文档内容写入 `innerHTML`。原生 HTML 通过解析和过滤后的 iframe `srcdoc` 渲染,与宿主 DOM 分离。
17
18
  - 表达式使用自己的解析器和 AST 求值器,不使用 `eval`、`new Function`,不支持赋值、方法调用、属性访问、原型路径或导入。表达式只能读取文档声明的参数和内置函数。
18
19
  - LaTeX 通过受预算限制的解析器计算,并由原生 MathML 渲染;渲染器不执行宏、文件、网络或 HTML 入口。未知命令显示为文本。
19
20
  - 表达式、模板、表格和图表不会发起网络请求;图表数据必须写在文档里。
@@ -59,7 +60,7 @@ Reactive MD 渲染作者编写的本地交互文档。文档是不可信输入
59
60
  ### 可分享 HTML 导出
60
61
 
61
62
  - `reactive-md-state/v1` 只保存公开绑定名和可序列化值,不保存 `@` 内部绑定、revision、节点 ID、AST、UI 状态或计时器。导入前会校验源码摘要、语法、参数集合和每个值;未知或冲突键会拒绝整个文件。
62
- - 交互式 HTML 内嵌固定版本的独立运行时,CSP 禁止网络连接、frame、object、base 注入和表单提交,只允许内联样式/运行时与 `data:` 图片。JSON、源码、标题和 notices 会按 HTML/脚本上下文转义。
63
+ - 默认 ReactiveMD 交互导出内嵌固定版本的独立运行时,CSP 禁止网络连接、frame、object、base 注入和表单提交。原生 HTML 导出额外允许承载文档的沙箱 `srcdoc` frame,其内部 CSP 控制作者 CSS 与脚本。JSON、源码、标题和 notices 会按 HTML/脚本上下文转义。
63
64
  - CLI 只内联位于文档目录或显式资源根内的相对位图。它拒绝远程图片、URL scheme、绝对路径、路径穿越、符号链接逃逸、SVG、伪造格式和超限资源。Demo 导出对话框在包含图片时会禁用 HTML 导出。
64
65
  - 静态 HTML 不包含运行时脚本或自动挂载载荷。静态首屏水合目前只在单文件 Chromium/Edge 路径验证,不构成通用水合或沙箱保证。作者完全不可信时应使用 sandboxed iframe。
65
66
  - 导出当前参数是宿主/读者的显式动作。生成的状态文件和 HTML 可能包含敏感信息;除非确实要分享当前值,否则应选择作者初值。
package/SECURITY.md CHANGED
@@ -12,8 +12,9 @@ The guarantees below are covered by compiler, runtime and renderer tests; capabi
12
12
 
13
13
  ### Document content
14
14
 
15
- - Authors cannot execute scripts. `<script>`, raw HTML, `on-*` event attributes and author CSS are not part of `local-draft-2`; they are treated as syntax diagnostics or text, never executed as HTML.
16
- - The React renderer does not call `dangerouslySetInnerHTML` and does not write document content into `innerHTML`.
15
+ - With the three HTML capability options off, author scripts, event attributes and CSS remain inert. P0 HTML is rebuilt as typed nodes and React elements. See [HTML compatibility and the temporary routing policy](docs/html-compatibility-en.md).
16
+ - Enabling `enableCss`, `enableJavaScript` or `enableExtendedHtml` routes the entire source to native HTML inside a sandboxed iframe without `allow-same-origin`. The other flags still constrain author source. Arbitrary enabled JavaScript can create DOM elements and styles dynamically; individual source flags are not runtime DOM permissions. CSP and sandbox restrictions continue to govern network access, forms and navigation.
17
+ - The default React renderer does not call `dangerouslySetInnerHTML` or write document content into `innerHTML`. Native HTML uses a parsed and filtered iframe `srcdoc`, separate from the host DOM.
17
18
  - Expressions use their own parser and AST evaluator, with no `eval` or `new Function`, and no support for assignment, method calls, property access, prototype paths or imports. Expressions can only read parameters declared by the document and built-in functions.
18
19
  - LaTeX is evaluated by a budget-limited parser and rendered as native MathML; the renderer does not execute macros, files, network or HTML entry points. Unknown commands are displayed as text.
19
20
  - Expressions, templates, tables and charts do not make network requests; chart data must be written in the document.
@@ -59,7 +60,7 @@ Hosts can adjust the syntax node budget for a single compilation with `compileLo
59
60
  ### Shareable HTML export
60
61
 
61
62
  - `reactive-md-state/v1` stores only public binding names and serializable values. It excludes `@` internal bindings, revisions, node IDs, AST data, UI state and timers. Source digest, syntax, parameter set and every value are validated before import; unknown or conflicting keys reject the whole file.
62
- - Interactive HTML embeds a fixed standalone runtime and a CSP with no network connections, frames, objects, base injection or form submission. Only inline styles/runtime and `data:` images are allowed. JSON, source, titles and notices are escaped for their HTML/script context.
63
+ - Default ReactiveMD interactive exports embed a fixed standalone runtime and a CSP with no network connections, frames, objects, base injection or form submission. Native HTML exports additionally permit the sandboxed `srcdoc` frame that holds the document; its own CSP governs author CSS and scripts. JSON, source, titles and notices are escaped for their HTML/script context.
63
64
  - The CLI inlines only relative raster files that resolve inside the document directory or an explicit asset root. It rejects remote images, URL schemes, absolute paths, traversal, symlink escapes, SVG, forged formats and oversized assets. The demo export dialog disables HTML export when images are present.
64
65
  - Static HTML contains no runtime script or auto-mount payload. Static-first hydration is covered only in the single-file Chromium/Edge path; it is not a general hydration or sandboxing guarantee. Use a sandboxed iframe for fully untrusted authors.
65
66
  - Exporting current parameters is an explicit host/reader action. Treat the generated state file and HTML as potentially sensitive; choose initial values unless current values are intentionally meant to be shared.
@@ -1,6 +1,6 @@
1
1
  # Third-party notices
2
2
 
3
- Reactive MD bundles its Markdown dependencies. The standalone HTML runtime also bundles React, React DOM and scheduler. This file preserves license texts for those installed dependency trees, including supporting type packages. The library React entry uses host-provided React and React DOM peers.
3
+ Reactive MD bundles its Markdown, HTML parsing and syntax-highlighting dependencies. The standalone HTML runtime also bundles React, React DOM and scheduler. This file preserves license texts for those installed dependency trees, including supporting type packages. The library React entry uses host-provided React and React DOM peers.
4
4
 
5
5
  Regenerate after dependency updates with `node scripts/generate-notices.mjs`.
6
6
 
@@ -32,6 +32,34 @@ MIT License
32
32
  SOFTWARE
33
33
  ```
34
34
 
35
+ ## @types/hast@3.0.5
36
+
37
+ Declared license: MIT
38
+
39
+ ```text
40
+ MIT License
41
+
42
+ Copyright (c) Microsoft Corporation.
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining a copy
45
+ of this software and associated documentation files (the "Software"), to deal
46
+ in the Software without restriction, including without limitation the rights
47
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48
+ copies of the Software, and to permit persons to whom the Software is
49
+ furnished to do so, subject to the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be included in all
52
+ copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
60
+ SOFTWARE
61
+ ```
62
+
35
63
  ## @types/mdast@4.0.4
36
64
 
37
65
  Declared license: MIT
@@ -315,6 +343,24 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
315
343
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
316
344
  ```
317
345
 
346
+ ## entities@8.1.0
347
+
348
+ Declared license: BSD-2-Clause
349
+
350
+ ```text
351
+ Copyright (c) Felix Böhm
352
+ All rights reserved.
353
+
354
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
355
+
356
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
357
+
358
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
359
+
360
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
361
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
362
+ ```
363
+
318
364
  ## escape-string-regexp@5.0.0
319
365
 
320
366
  Declared license: MIT
@@ -360,6 +406,42 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
360
406
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
361
407
  ```
362
408
 
409
+ ## highlight.js@11.11.2
410
+
411
+ Declared license: BSD-3-Clause
412
+
413
+ ```text
414
+ BSD 3-Clause License
415
+
416
+ Copyright (c) 2006, Ivan Sagalaev.
417
+ All rights reserved.
418
+
419
+ Redistribution and use in source and binary forms, with or without
420
+ modification, are permitted provided that the following conditions are met:
421
+
422
+ * Redistributions of source code must retain the above copyright notice, this
423
+ list of conditions and the following disclaimer.
424
+
425
+ * Redistributions in binary form must reproduce the above copyright notice,
426
+ this list of conditions and the following disclaimer in the documentation
427
+ and/or other materials provided with the distribution.
428
+
429
+ * Neither the name of the copyright holder nor the names of its
430
+ contributors may be used to endorse or promote products derived from
431
+ this software without specific prior written permission.
432
+
433
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
434
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
435
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
436
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
437
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
438
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
439
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
440
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
441
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
442
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
443
+ ```
444
+
363
445
  ## is-plain-obj@4.1.0
364
446
 
365
447
  Declared license: MIT
@@ -405,6 +487,35 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
405
487
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
406
488
  ```
407
489
 
490
+ ## lowlight@3.3.0
491
+
492
+ Declared license: MIT
493
+
494
+ ```text
495
+ (The MIT License)
496
+
497
+ Copyright (c) Titus Wormer <tituswormer@gmail.com>
498
+
499
+ Permission is hereby granted, free of charge, to any person obtaining
500
+ a copy of this software and associated documentation files (the
501
+ 'Software'), to deal in the Software without restriction, including
502
+ without limitation the rights to use, copy, modify, merge, publish,
503
+ distribute, sublicense, and/or sell copies of the Software, and to
504
+ permit persons to whom the Software is furnished to do so, subject to
505
+ the following conditions:
506
+
507
+ The above copyright notice and this permission notice shall be
508
+ included in all copies or substantial portions of the Software.
509
+
510
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
511
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
512
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
513
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
514
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
515
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
516
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
517
+ ```
518
+
408
519
  ## markdown-table@3.0.4
409
520
 
410
521
  Declared license: MIT
@@ -1623,6 +1734,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1623
1734
  SOFTWARE.
1624
1735
  ```
1625
1736
 
1737
+ ## parse5@8.0.1
1738
+
1739
+ Declared license: MIT
1740
+
1741
+ ```text
1742
+ Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin)
1743
+
1744
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1745
+ of this software and associated documentation files (the "Software"), to deal
1746
+ in the Software without restriction, including without limitation the rights
1747
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1748
+ copies of the Software, and to permit persons to whom the Software is
1749
+ furnished to do so, subject to the following conditions:
1750
+
1751
+ The above copyright notice and this permission notice shall be included in
1752
+ all copies or substantial portions of the Software.
1753
+
1754
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1755
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1756
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1757
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1758
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1759
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1760
+ THE SOFTWARE.
1761
+ ```
1762
+
1626
1763
  ## react-dom@19.3.1
1627
1764
 
1628
1765
  Declared license: MIT
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  /*
3
3
  * reactive-md command-line interface.
4
4
  *