reactive-md 0.5.3 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG-ch.md +195 -165
  2. package/CHANGELOG.md +195 -165
  3. package/CONTRIBUTING-ch.md +67 -62
  4. package/CONTRIBUTING.md +69 -64
  5. package/README-ch.md +157 -155
  6. package/README-en.md +184 -181
  7. package/README.md +184 -181
  8. package/SECURITY-ch.md +81 -81
  9. package/SECURITY.md +81 -81
  10. package/THIRD_PARTY_NOTICES.md +585 -1
  11. package/bin/reactive-md.mjs +39 -39
  12. package/cli/args.mjs +181 -181
  13. package/cli/assets.mjs +390 -390
  14. package/cli/build.mjs +268 -268
  15. package/cli/document.mjs +130 -130
  16. package/cli/errors.mjs +61 -61
  17. package/cli/fs-utils.mjs +133 -133
  18. package/cli/glob.mjs +203 -203
  19. package/cli/help.mjs +138 -138
  20. package/cli/lint.mjs +177 -177
  21. package/cli/main.mjs +55 -55
  22. package/cli/migrate.mjs +368 -368
  23. package/cli/package.mjs +210 -210
  24. package/dist-library/{authoring-DJJjKYg9.js → authoring-BEVyth5X.js} +58 -58
  25. package/dist-library/compiler-Cm3ppMxG.js +46044 -0
  26. package/dist-library/react-Bh7_oxZp.js +59655 -0
  27. package/dist-library/reactive-md-authoring.js +2 -2
  28. package/dist-library/reactive-md-editor.js +13 -0
  29. package/dist-library/reactive-md-print.css +284 -284
  30. package/dist-library/reactive-md-react-unstyled.js +1 -1
  31. package/dist-library/reactive-md-react.js +1 -1
  32. package/dist-library/reactive-md.css +1 -1
  33. package/dist-library/reactive-md.js +123 -123
  34. package/dist-library/{runtime-DXtle_6c.js → runtime-DlFYQ4s_.js} +151 -151
  35. package/dist-library/types/editor/types.d.ts +2 -0
  36. package/dist-library/types/local/code-block.d.ts +3 -1
  37. package/dist-library/types/local/code-languages.d.ts +7 -0
  38. package/dist-library/types/local/compiled-data.d.ts +6 -0
  39. package/dist-library/types/local/compiler.d.ts +1 -0
  40. package/dist-library/types/local/diagnostics.d.ts +31 -0
  41. package/dist-library/types/local/diagram-layout.d.ts +69 -0
  42. package/dist-library/types/local/html-names.d.ts +6 -0
  43. package/dist-library/types/local/html-table.d.ts +25 -0
  44. package/dist-library/types/local/math-display.d.ts +22 -22
  45. package/dist-library/types/local/math-view.d.ts +6 -7
  46. package/dist-library/types/local/table-surface.d.ts +10 -0
  47. package/dist-library/types/local/types.d.ts +2 -0
  48. package/dist-library/types/local/visuals.d.ts +9 -0
  49. package/dist-standalone/reactive-md-standalone.css +1 -1
  50. package/dist-standalone/reactive-md-standalone.js +331 -51
  51. package/docs/README.md +84 -0
  52. package/docs/{compatibility-ch.md → compatibility/compatibility-ch.md} +121 -109
  53. package/docs/{compatibility-en.md → compatibility/compatibility-en.md} +121 -109
  54. package/docs/{source-versioning-ch.md → compatibility/source-versioning-ch.md} +159 -159
  55. package/docs/{source-versioning-en.md → compatibility/source-versioning-en.md} +159 -159
  56. package/docs/{component-development-ch.md → development/component-development-ch.md} +210 -210
  57. package/docs/{component-development-en.md → development/component-development-en.md} +210 -210
  58. package/docs/{component-protocol-ch.md → development/component-protocol-ch.md} +747 -747
  59. package/docs/{component-protocol-en.md → development/component-protocol-en.md} +747 -747
  60. package/docs/{performance-ch.md → development/performance-ch.md} +76 -76
  61. package/docs/{performance-en.md → development/performance-en.md} +76 -76
  62. package/docs/{releasing-ch.md → development/releasing-ch.md} +108 -108
  63. package/docs/{releasing-en.md → development/releasing-en.md} +108 -108
  64. package/docs/guides/local-guide-ch.md +513 -0
  65. package/docs/guides/local-guide-en.md +513 -0
  66. package/docs/{author-tools-ch.md → integration/author-tools-ch.md} +57 -57
  67. package/docs/{author-tools-en.md → integration/author-tools-en.md} +57 -57
  68. package/docs/{editor-ch.md → integration/editor-ch.md} +7 -6
  69. package/docs/{editor-en.md → integration/editor-en.md} +7 -6
  70. package/docs/{local-integration-ch.md → integration/local-integration-ch.md} +33 -15
  71. package/docs/{local-integration-en.md → integration/local-integration-en.md} +33 -15
  72. package/docs/{shareable-export-ch.md → integration/shareable-export-ch.md} +221 -209
  73. package/docs/{shareable-export-en.md → integration/shareable-export-en.md} +223 -211
  74. package/docs/{computations-formatting-ch.md → reference/computations-formatting-ch.md} +87 -87
  75. package/docs/{computations-formatting-en.md → reference/computations-formatting-en.md} +87 -87
  76. package/docs/{constraints-collections-ch.md → reference/constraints-collections-ch.md} +84 -84
  77. package/docs/{constraints-collections-en.md → reference/constraints-collections-en.md} +84 -84
  78. package/docs/{diagnostics-counting-ch.md → reference/diagnostics-counting-ch.md} +104 -84
  79. package/docs/{diagnostics-counting-en.md → reference/diagnostics-counting-en.md} +104 -84
  80. package/docs/{html-compatibility-ch.md → reference/html-compatibility-ch.md} +42 -4
  81. package/docs/{html-compatibility-en.md → reference/html-compatibility-en.md} +42 -4
  82. package/docs/{local-components-v2-ch.md → reference/local-components-v2-ch.md} +138 -138
  83. package/docs/{local-components-v2-en.md → reference/local-components-v2-en.md} +104 -104
  84. package/docs/{local-interaction-syntax-ch.md → reference/local-interaction-syntax-ch.md} +515 -492
  85. package/docs/{local-interaction-syntax-en.md → reference/local-interaction-syntax-en.md} +511 -488
  86. package/docs/{theme-protocol-ch.md → reference/theme-protocol-ch.md} +107 -107
  87. package/docs/{theme-protocol-en.md → reference/theme-protocol-en.md} +107 -107
  88. package/docs/{release-0.4.0-ch.md → releases/release-0.4.0-ch.md} +89 -89
  89. package/docs/{release-0.4.0-en.md → releases/release-0.4.0-en.md} +89 -89
  90. package/docs/{release-0.4.1-ch.md → releases/release-0.4.1-ch.md} +23 -23
  91. package/docs/{release-0.4.1-en.md → releases/release-0.4.1-en.md} +23 -23
  92. package/docs/{release-0.5.0-ch.md → releases/release-0.5.0-ch.md} +4 -4
  93. package/docs/{release-0.5.0-en.md → releases/release-0.5.0-en.md} +4 -4
  94. package/docs/{release-0.5.1-ch.md → releases/release-0.5.1-ch.md} +4 -4
  95. package/docs/{release-0.5.1-en.md → releases/release-0.5.1-en.md} +4 -4
  96. package/docs/{release-0.5.2-ch.md → releases/release-0.5.2-ch.md} +3 -3
  97. package/docs/{release-0.5.2-en.md → releases/release-0.5.2-en.md} +3 -3
  98. package/docs/{release-0.5.3-ch.md → releases/release-0.5.3-ch.md} +1 -1
  99. package/docs/{release-0.5.3-en.md → releases/release-0.5.3-en.md} +1 -1
  100. package/docs/releases/release-0.6.0-ch.md +57 -0
  101. package/docs/releases/release-0.6.0-en.md +57 -0
  102. package/docs/releases/release-0.6.1-ch.md +27 -0
  103. package/docs/releases/release-0.6.1-en.md +27 -0
  104. package/examples/conformance/README.md +53 -53
  105. package/examples/conformance/component-protocol-1.json +482 -482
  106. package/examples/conformance/component-protocol-1.schema.json +76 -76
  107. package/examples/conformance/local-draft-1.json +50 -50
  108. package/examples/conformance/local-draft-2.json +212 -212
  109. package/examples/integration/README.md +47 -45
  110. package/examples/integration/core/index.mjs +32 -32
  111. package/examples/integration/worker/index.html +19 -19
  112. package/examples/integration/worker/main.js +61 -61
  113. package/examples/integration/worker/package.json +13 -13
  114. package/examples/integration/worker/worker.js +3 -3
  115. package/examples/local/README.md +74 -74
  116. package/examples/local/charts.reactive.md +73 -73
  117. package/examples/local/html-compat.reactive.md +19 -0
  118. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  119. package/examples/local/recipes/invoice.reactive.md +36 -36
  120. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  121. package/examples/local/recipes/workshop.reactive.md +33 -33
  122. package/examples/local/showcase/README.md +25 -25
  123. package/examples/local/showcase/explore.reactive.md +102 -102
  124. package/examples/local/showcase/flow.reactive.md +86 -86
  125. package/examples/local/showcase/forms.reactive.md +126 -126
  126. package/examples/local/showcase/functions.reactive.md +119 -119
  127. package/examples/local/showcase/layout.reactive.md +100 -100
  128. package/examples/local/showcase/statistics.reactive.md +108 -108
  129. package/examples/local/showcase/tasks.reactive.md +89 -89
  130. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  131. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  132. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  133. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  134. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  135. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  136. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  137. package/package.json +152 -145
  138. package/dist-library/compiler-UyPwGzJZ.js +0 -22109
  139. package/dist-library/react-fizgU3i8.js +0 -12764
  140. package/docs/local-guide-ch.md +0 -967
  141. package/docs/local-guide-en.md +0 -967
package/README-en.md CHANGED
@@ -1,181 +1,184 @@
1
- # Reactive MD
2
-
3
- [中文](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.3` is the preview for the `next` channel and adds host integration and authoring patches; `latest` remains `0.4.0`. Syntax revision stays `local-draft-2`, and the component protocol is `component-protocol-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.3 release notes](docs/release-0.5.3-en.md): host integration and authoring patches.
23
- - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
24
- - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
25
- - [0.4.1 release notes](docs/release-0.4.1-en.md): visual and interaction fixes, compatible with 0.4.0.
26
- - [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`.
27
-
28
- ## Write a document
29
-
30
- ```markdown
31
- <panel title="Cost estimate">
32
- <slider bind="people" label="People" initial="2" min="1" max="20">
33
- <toggle bind="annual" label="Annual billing">
34
- </panel>
35
-
36
- Monthly cost: **{{ people * (annual ? 80 : 100) }} USD**.
37
- ```
38
-
39
- Inputs update the result immediately, and the panel includes a restore-defaults action. A standalone counter is a single line: `<counter label="People">`.
40
-
41
- `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).
42
-
43
- ## Install
44
-
45
- Reactive MD requires Node.js 22.12 or newer and ships only ESM entries:
46
-
47
- ```sh
48
- npm install reactive-md
49
- ```
50
-
51
- `latest` resolves to `0.4.0`. The 0.5.3 preview targets `next`:
52
-
53
- ```sh
54
- npm install reactive-md@next
55
- # or pin the preview
56
- npm install reactive-md@0.5.3
57
- ```
58
-
59
- Read the [0.5.3 release notes](docs/release-0.5.3-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`.
60
-
61
- 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.3.
62
-
63
- The core `reactive-md` entry does not depend on React:
64
-
65
- ```js
66
- import { compileLocal, createLocalRuntime } from 'reactive-md';
67
-
68
- const result = compileLocal('<number bind="n" label="Count" initial="2">');
69
- if (result.ok) {
70
- const runtime = createLocalRuntime(result.document);
71
- try { console.log(runtime.text('Total: {{ n * 100 }}')); }
72
- finally { runtime.dispose(); }
73
- }
74
- ```
75
-
76
- See [Local mode integration](docs/local-integration-en.md) for the full compile and runtime APIs, host URL policy, lifecycle and style overrides.
77
-
78
- 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.
79
-
80
- ## Use with React
81
-
82
- The React entry requires React 19:
83
-
84
- ```sh
85
- npm install react@19 react-dom@19
86
- ```
87
-
88
- ```tsx
89
- import { LocalReactiveDocument } from 'reactive-md/react';
90
- import 'reactive-md/styles.css';
91
-
92
- export function Article({ source }: { source: string }) {
93
- return <LocalReactiveDocument source={source} />;
94
- }
95
- ```
96
-
97
- `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).
98
-
99
- ## Edit source with React
100
-
101
- 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:
102
-
103
- ```tsx
104
- import { useState } from 'react';
105
- import { ReactiveMarkdownEditor } from 'reactive-md/editor';
106
- import 'reactive-md/editor/styles.css';
107
-
108
- export function Editor() {
109
- const [source, setSource] = useState('# Notes');
110
- return <ReactiveMarkdownEditor value={source} onChange={setSource} />;
111
- }
112
- ```
113
-
114
- 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.
115
-
116
- ## Share documents
117
-
118
- Build a self-contained HTML file that readers can open offline, or a script-free static snapshot:
119
-
120
- ```sh
121
- npm run build
122
- npx reactive-md build examples/local/counter.reactive.md -o counter.html
123
- npx reactive-md build examples/local/counter.reactive.md -o counter-static.html --mode static
124
- ```
125
-
126
- 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.
127
-
128
- 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>`.
129
-
130
- ## Try the demo
131
-
132
- ```sh
133
- npm ci
134
- npm run dev
135
- ```
136
-
137
- 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.
138
-
139
- ## Repository layout
140
-
141
- ```text
142
- src/ Local syntax compilation, expressions, runtime and React renderer
143
- examples/ Copyable local interactive examples, independent of the demo app
144
- docs/ Local syntax specification, integration and release documentation
145
- tests/ Language and renderer tests
146
- demo/ Standalone Playground app
147
- ```
148
-
149
- ## Documentation
150
-
151
- - [Beginner guide](docs/local-guide-en.md) and [local interaction syntax specification](docs/local-interaction-syntax-en.md).
152
- - [Local mode integration](docs/local-integration-en.md): core and React API, URL policy, lifecycle, styling and version pinning.
153
- - [Shareable documents and static export](docs/shareable-export-en.md): CLI build/lint, state files, local image inlining, printing and the standalone browser runtime.
154
- - [Feature tours and examples](examples/local/README.md) and [standalone integrations](examples/integration/README.md).
155
- - [React source editor](docs/editor-en.md): controlled editor for `.reactive.md` source, with its own stylesheet.
156
- - [Versions and compatibility](docs/compatibility-en.md): 0.x rules, migration, diagnostics and supported platforms.
157
- - [0.5.3 release notes](docs/release-0.5.3-en.md): host integration and authoring patches.
158
- - [0.5.1 release notes](docs/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
159
- - [0.5.0 release notes](docs/release-0.5.0-en.md): the editor entry and document rendering fixes.
160
- - [0.4.0 release and migration](docs/release-0.4.0-en.md): the upgrade checklist for that minor series.
161
- - [Component protocol](docs/component-protocol-en.md) and [component development guide](docs/component-development-en.md): contribution contracts, a proposal template and acceptance cases.
162
- - [Performance measurements](docs/performance-en.md) and [release checklist](docs/releasing-en.md).
163
-
164
- See the [contributing guide](CONTRIBUTING.md) for development and test commands.
165
-
166
- ## Support and status
167
-
168
- - 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.
169
- - 0.x minor releases may contain breaking changes. Persist the original `.reactive.md` source, not the runtime AST or in-memory state.
170
- - `latest` is `0.4.0`; the `0.5.3` preview targets `next`. Security fixes may ship in minor releases.
171
-
172
- ## Contributing and security
173
-
174
- - [Contributing guide](CONTRIBUTING.md): environment, check commands and change requirements.
175
- - [Security policy](SECURITY.md): threat boundary, resource limits, host responsibilities and vulnerability reporting.
176
- - [Changelog](CHANGELOG.md).
177
- - [Release checklist](docs/releasing-en.md): the verification gate, notices, tarball and the manual release flow for maintainers.
178
-
179
- ## License
180
-
181
- [MIT](LICENSE)
1
+ # Reactive MD
2
+
3
+ [中文](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.6.1` is available on both `latest` and `next` and switches formula display to KaTeX with bundled math fonts and offline HTML support. Syntax revision stays `local-draft-2`, and the component protocol is `component-protocol-2`. See [README-ch.md](README-ch.md) for the Chinese overview.
8
+
9
+ ## Start here
10
+
11
+ - [Documentation index](docs/README.md): guides, references, integration, compatibility, development and releases.
12
+ - [Beginner guide](docs/guides/local-guide-en.md): move from Markdown to interactive documents, with a complete exercise and an error quick reference.
13
+ - [Local interaction syntax specification](docs/reference/local-interaction-syntax-en.md) · [Feature tours and examples](examples/local/README.md): 48 tag names, tags, in-place parameters and LaTeX plots.
14
+ - [Local mode integration](docs/integration/local-integration-en.md): `compileLocal`, the state runtime, React embedding, URL policy and style scoping.
15
+ - [HTML compatibility](docs/reference/html-compatibility-en.md): P0 HTML and the next release's temporary routing policy for author CSS, JavaScript and extended HTML.
16
+ - [Shareable documents and static export](docs/integration/shareable-export-en.md): single-file interactive HTML, static output, versioned state files, assets, the CLI and the standalone browser API.
17
+ - [Theme protocol](docs/reference/theme-protocol-en.md): document theme selection, custom CSS and light/dark modes.
18
+ - [Author tools](docs/integration/author-tools-en.md): source highlighting, completion, binding navigation, rename, formatting and command-line lint.
19
+ - [React source editor](docs/integration/editor-en.md): controlled editor, props, ref handle, diagnostics, locale, theme and history.
20
+ - [Standalone integration examples](examples/integration/README.md): Node core and React pages you can copy and run outside the repository.
21
+ - [Versions and compatibility](docs/compatibility/compatibility-en.md): 0.x rules, migration, the diagnostics contract and supported platforms.
22
+ - [Component protocol](docs/development/component-protocol-en.md) · [Component development guide](docs/development/component-development-en.md): declarations, behavior contracts and compatibility acceptance for new components.
23
+ - [0.6.1 release notes](docs/releases/release-0.6.1-en.md): KaTeX formula display, bundled fonts and offline math.
24
+ - [0.5.3 release notes](docs/releases/release-0.5.3-en.md): host integration and authoring patches.
25
+ - [0.5.1 release notes](docs/releases/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
26
+ - [0.5.0 release notes](docs/releases/release-0.5.0-en.md): the editor entry and document rendering fixes.
27
+ - [0.4.1 release notes](docs/releases/release-0.4.1-en.md): visual and interaction fixes, compatible with 0.4.0.
28
+ - [0.4.0 release and migration](docs/releases/release-0.4.0-en.md): what the minor series adds and how to upgrade from `0.3.1` / `local-draft-1`.
29
+
30
+ ## Write a document
31
+
32
+ ```markdown
33
+ <panel title="Cost estimate">
34
+ <slider bind="people" label="People" initial="2" min="1" max="20">
35
+ <toggle bind="annual" label="Annual billing">
36
+ </panel>
37
+
38
+ Monthly cost: **{{ people * (annual ? 80 : 100) }} USD**.
39
+ ```
40
+
41
+ Inputs update the result immediately, and the panel includes a restore-defaults action. A standalone counter is a single line: `<counter label="People">`.
42
+
43
+ `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/releases/release-0.4.0-en.md).
44
+
45
+ ## Install
46
+
47
+ Reactive MD requires Node.js 22.12 or newer and ships only ESM entries:
48
+
49
+ ```sh
50
+ npm install reactive-md
51
+ ```
52
+
53
+ `latest` and `next` both resolve to `0.6.1`:
54
+
55
+ ```sh
56
+ npm install reactive-md
57
+ # or pin the version
58
+ npm install reactive-md@0.6.1
59
+ ```
60
+
61
+ Read the [0.6.1 release notes](docs/releases/release-0.6.1-en.md) for this release, and the [migration guide](docs/releases/release-0.4.0-en.md) before upgrading from `0.3.1` / `local-draft-1`.
62
+
63
+ 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.6.1.
64
+
65
+ The core `reactive-md` entry does not depend on React:
66
+
67
+ ```js
68
+ import { compileLocal, createLocalRuntime } from 'reactive-md';
69
+
70
+ const result = compileLocal('<number bind="n" label="Count" initial="2">');
71
+ if (result.ok) {
72
+ const runtime = createLocalRuntime(result.document);
73
+ try { console.log(runtime.text('Total: {{ n * 100 }}')); }
74
+ finally { runtime.dispose(); }
75
+ }
76
+ ```
77
+
78
+ See [Local mode integration](docs/integration/local-integration-en.md) for the full compile and runtime APIs, host URL policy, lifecycle and style overrides.
79
+
80
+ 0.x minor releases may contain breaking changes. Before upgrading, read the [changelog](CHANGELOG.md) and [compatibility rules](docs/compatibility/compatibility-en.md), and keep the original `.reactive.md` sources.
81
+
82
+ ## Use with React
83
+
84
+ The React entry requires React 19:
85
+
86
+ ```sh
87
+ npm install react@19 react-dom@19
88
+ ```
89
+
90
+ ```tsx
91
+ import { LocalReactiveDocument } from 'reactive-md/react';
92
+ import 'reactive-md/styles.css';
93
+
94
+ export function Article({ source }: { source: string }) {
95
+ return <LocalReactiveDocument source={source} />;
96
+ }
97
+ ```
98
+
99
+ `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/integration/local-integration-en.md).
100
+
101
+ ## Edit source with React
102
+
103
+ 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:
104
+
105
+ ```tsx
106
+ import { useState } from 'react';
107
+ import { ReactiveMarkdownEditor } from 'reactive-md/editor';
108
+ import 'reactive-md/editor/styles.css';
109
+
110
+ export function Editor() {
111
+ const [source, setSource] = useState('# Notes');
112
+ return <ReactiveMarkdownEditor value={source} onChange={setSource} />;
113
+ }
114
+ ```
115
+
116
+ 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/integration/editor-en.md) for the props, ref handle, diagnostics, themes, locales and history.
117
+
118
+ ## Share documents
119
+
120
+ Build a self-contained HTML file that readers can open offline, or a script-free static snapshot:
121
+
122
+ ```sh
123
+ npm run build
124
+ npx reactive-md build examples/local/counter.reactive.md -o counter.html
125
+ npx reactive-md build examples/local/counter.reactive.md -o counter-static.html --mode static
126
+ ```
127
+
128
+ 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.
129
+
130
+ See [Shareable documents and static export](docs/integration/shareable-export-en.md) for image limits, CSP/security, printing, exit codes, `ReactiveMD.mount`/`mountAll` and `<reactive-md-doc>`.
131
+
132
+ ## Try the demo
133
+
134
+ ```sh
135
+ npm ci
136
+ npm run dev
137
+ ```
138
+
139
+ 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.
140
+
141
+ ## Repository layout
142
+
143
+ ```text
144
+ src/ Local syntax compilation, expressions, runtime and React renderer
145
+ examples/ Copyable local interactive examples, independent of the demo app
146
+ docs/ Local syntax specification, integration and release documentation
147
+ tests/ Language and renderer tests
148
+ demo/ Standalone Playground app
149
+ ```
150
+
151
+ ## Documentation
152
+
153
+ - [Beginner guide](docs/guides/local-guide-en.md) and [local interaction syntax specification](docs/reference/local-interaction-syntax-en.md).
154
+ - [Local mode integration](docs/integration/local-integration-en.md): core and React API, URL policy, lifecycle, styling and version pinning.
155
+ - [Shareable documents and static export](docs/integration/shareable-export-en.md): CLI build/lint, state files, local image inlining, printing and the standalone browser runtime.
156
+ - [Feature tours and examples](examples/local/README.md) and [standalone integrations](examples/integration/README.md).
157
+ - [React source editor](docs/integration/editor-en.md): controlled editor for `.reactive.md` source, with its own stylesheet.
158
+ - [Versions and compatibility](docs/compatibility/compatibility-en.md): 0.x rules, migration, diagnostics and supported platforms.
159
+ - [0.6.1 release notes](docs/releases/release-0.6.1-en.md): KaTeX formula display, bundled fonts and offline math.
160
+ - [0.5.3 release notes](docs/releases/release-0.5.3-en.md): host integration and authoring patches.
161
+ - [0.5.1 release notes](docs/releases/release-0.5.1-en.md): editor views and themes, plus HTML compatibility.
162
+ - [0.5.0 release notes](docs/releases/release-0.5.0-en.md): the editor entry and document rendering fixes.
163
+ - [0.4.0 release and migration](docs/releases/release-0.4.0-en.md): the upgrade checklist for that minor series.
164
+ - [Component protocol](docs/development/component-protocol-en.md) and [component development guide](docs/development/component-development-en.md): contribution contracts, a proposal template and acceptance cases.
165
+ - [Performance measurements](docs/development/performance-en.md) and [release checklist](docs/development/releasing-en.md).
166
+
167
+ See the [contributing guide](CONTRIBUTING.md) for development and test commands.
168
+
169
+ ## Support and status
170
+
171
+ - CI targets Node 22.12 and Node 24 with Playwright Chromium for the full browser gate and Firefox/WebKit for core workflows; 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 and the full Firefox/WebKit interaction suites remain unverified.
172
+ - 0.x minor releases may contain breaking changes. Persist the original `.reactive.md` source, not the runtime AST or in-memory state.
173
+ - `latest` and `next` are both `0.6.1`. Security fixes may ship in minor releases.
174
+
175
+ ## Contributing and security
176
+
177
+ - [Contributing guide](CONTRIBUTING.md): environment, check commands and change requirements.
178
+ - [Security policy](SECURITY.md): threat boundary, resource limits, host responsibilities and vulnerability reporting.
179
+ - [Changelog](CHANGELOG.md).
180
+ - [Release checklist](docs/development/releasing-en.md): the verification gate, notices, tarball and the manual release flow for maintainers.
181
+
182
+ ## License
183
+
184
+ [MIT](LICENSE)