reactive-md 0.4.0 → 0.4.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.
- package/CHANGELOG-ch.md +113 -96
- package/CHANGELOG.md +113 -96
- package/LICENSE +21 -21
- package/README-ch.md +123 -122
- package/README-en.md +147 -146
- package/README.md +147 -146
- package/bin/reactive-md.mjs +1 -1
- package/dist-library/reactive-md-react.js +199 -103
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1 -1
- package/dist-library/{runtime-DtjdPXxJ.js → runtime-D3QTVYaz.js} +122 -122
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +1 -1
- package/docs/compatibility-ch.md +3 -3
- package/docs/compatibility-en.md +3 -3
- package/docs/release-0.4.0-ch.md +4 -4
- package/docs/release-0.4.0-en.md +4 -4
- package/docs/release-0.4.1-ch.md +23 -0
- package/docs/release-0.4.1-en.md +23 -0
- package/docs/releasing-ch.md +101 -101
- package/docs/releasing-en.md +101 -101
- package/examples/integration/core/package.json +7 -7
- package/examples/integration/react/index.html +12 -12
- package/examples/integration/react/main.jsx +21 -21
- package/examples/integration/react/package.json +9 -9
- package/examples/local/catalog.reactive.md +20 -20
- package/examples/local/checklist.reactive.md +32 -32
- package/examples/local/comparison.reactive.md +47 -47
- package/examples/local/components.reactive.md +44 -44
- package/examples/local/counter.reactive.md +7 -7
- package/examples/local/diagnostics.reactive.md +54 -54
- package/examples/local/diagram.reactive.md +44 -44
- package/examples/local/gallery.reactive.md +61 -61
- package/examples/local/parameters.reactive.md +36 -36
- package/examples/local/planning.reactive.md +24 -24
- package/examples/local/pricing.reactive.md +20 -20
- package/examples/local/zh/catalog.reactive.md +20 -20
- package/examples/local/zh/charts.reactive.md +73 -73
- package/examples/local/zh/checklist.reactive.md +32 -32
- package/examples/local/zh/comparison.reactive.md +47 -47
- package/examples/local/zh/components.reactive.md +44 -44
- package/examples/local/zh/counter.reactive.md +7 -7
- package/examples/local/zh/diagnostics.reactive.md +54 -54
- package/examples/local/zh/diagram.reactive.md +44 -44
- package/examples/local/zh/gallery.reactive.md +61 -61
- package/examples/local/zh/parameters.reactive.md +36 -36
- package/examples/local/zh/planning.reactive.md +24 -24
- package/examples/local/zh/pricing.reactive.md +20 -20
- package/package.json +91 -90
package/README.md
CHANGED
|
@@ -1,146 +1,147 @@
|
|
|
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.
|
|
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.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
import 'reactive-md/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
npx reactive-md build examples/local/counter.reactive.md -o counter
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
npm
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
- [
|
|
122
|
-
- [
|
|
123
|
-
- [
|
|
124
|
-
- [
|
|
125
|
-
- [
|
|
126
|
-
- [
|
|
127
|
-
- [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
- [
|
|
141
|
-
- [
|
|
142
|
-
- [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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)
|
package/bin/reactive-md.mjs
CHANGED