reactive-md 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +128 -113
- package/CHANGELOG.md +128 -113
- package/LICENSE +21 -21
- package/README-ch.md +152 -123
- package/README-en.md +176 -147
- package/README.md +176 -147
- package/THIRD_PARTY_NOTICES.md +94 -1
- package/bin/reactive-md.mjs +1 -1
- package/dist-library/reactive-md-editor.css +2 -0
- package/dist-library/reactive-md-editor.js +3710 -0
- package/dist-library/reactive-md-react.js +9035 -1558
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +98 -97
- package/dist-library/{runtime-D3QTVYaz.js → runtime-DPuMxM_y.js} +1978 -1583
- package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +7 -0
- package/dist-library/types/editor/editor-commands.d.ts +50 -0
- package/dist-library/types/editor/editor-i18n.d.ts +102 -0
- package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
- package/dist-library/types/editor/extended-native-components.d.ts +58 -0
- package/dist-library/types/editor/index.d.ts +9 -0
- package/dist-library/types/editor/locale.d.ts +13 -0
- package/dist-library/types/editor/native-components.d.ts +47 -0
- package/dist-library/types/editor/source-authoring.d.ts +57 -0
- package/dist-library/types/editor/types.d.ts +44 -0
- package/dist-library/types/editor/use-gutter-metrics.d.ts +5 -0
- package/dist-library/types/editor/use-source-history.d.ts +16 -0
- package/dist-library/types/local/code-block.d.ts +24 -0
- package/dist-library/types/local/footnotes.d.ts +51 -0
- package/dist-library/types/local/image-view.d.ts +21 -0
- package/dist-library/types/local/types.d.ts +7 -0
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +47 -36
- package/docs/compatibility-ch.md +12 -8
- package/docs/compatibility-en.md +12 -8
- package/docs/component-protocol-ch.md +2 -2
- package/docs/component-protocol-en.md +2 -2
- package/docs/editor-ch.md +216 -0
- package/docs/editor-en.md +216 -0
- package/docs/local-guide-ch.md +11 -5
- package/docs/local-guide-en.md +11 -5
- package/docs/local-interaction-syntax-ch.md +7 -2
- package/docs/local-interaction-syntax-en.md +7 -2
- package/docs/release-0.4.1-ch.md +23 -23
- package/docs/release-0.4.1-en.md +23 -23
- package/docs/release-0.5.0-ch.md +41 -0
- package/docs/release-0.5.0-en.md +41 -0
- package/docs/releasing-ch.md +108 -101
- package/docs/releasing-en.md +108 -101
- package/docs/shareable-export-ch.md +4 -2
- package/docs/shareable-export-en.md +4 -2
- 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/integration/react-editor.tsx +74 -0
- 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 +133 -91
package/docs/releasing-en.md
CHANGED
|
@@ -1,101 +1,108 @@
|
|
|
1
|
-
# Release checklist
|
|
2
|
-
|
|
3
|
-
This file is the maintainers' manual release process. This checklist covers the `0.
|
|
4
|
-
|
|
5
|
-
## Before release
|
|
6
|
-
|
|
7
|
-
### Package identity and metadata
|
|
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. Do not treat a rename as routine release preparation: changing the name is a breaking change for imports, state tooling and documentation.
|
|
10
|
-
|
|
11
|
-
1. Keep `reactive-md` unless maintainers explicitly decide on a scoped rename. A scope requires the corresponding npm account or organization permissions.
|
|
12
|
-
2. If renaming, update `name` in `package.json`, import statements in the documentation, tarball filename references, examples and
|
|
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
|
-
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
|
-
|
|
16
|
-
The package name and version determine the tarball name. The expected filename for `0.
|
|
17
|
-
|
|
18
|
-
### Third-party notices
|
|
19
|
-
|
|
20
|
-
The library bundles `remark-gfm@4.0.1`, `remark-parse@11.0.0`, `unified@11.0.5` and their dependencies. The standalone HTML runtime also bundles React, React DOM and scheduler; the library React entry uses host-provided peers. All these bundles retain the installed dependencies' copyright and license notices in `THIRD_PARTY_NOTICES.md`.
|
|
21
|
-
|
|
22
|
-
Before releasing, maintainers:
|
|
23
|
-
|
|
24
|
-
1. Run `npm run notices` to regenerate `THIRD_PARTY_NOTICES.md` from installed dependencies. The generation script covers the dependency trees and actual license texts of `remark-gfm`, `remark-parse`, `unified`, `react` and `react-dom`, including scheduler.
|
|
25
|
-
2. Confirm `files` in `package.json` includes `THIRD_PARTY_NOTICES.md` so it ships in the tarball.
|
|
26
|
-
3. Inspect the output of `npm pack --dry-run` and confirm there is no `node_modules`, `demo/`, `demo/artifacts/`, test output or local cache.
|
|
27
|
-
4. Check that dependency licenses match the packaged content; regenerate notices after adding or upgrading Markdown dependencies.
|
|
28
|
-
|
|
29
|
-
## Local tarball installation
|
|
30
|
-
|
|
31
|
-
The complete local gate is:
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
npm ci
|
|
35
|
-
npm run verify:release
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
`verify:release` runs the Node-side and browser checks, builds the package, installs the real tarball outside the repository and exercises combined document behavior. It manages the preview server and browser lifecycle itself. CI splits the same gate with `verify:release:node` and `verify:release:browser`. A browser must already be installed locally.
|
|
39
|
-
|
|
40
|
-
The packed check retains the exact verified archive in `artifacts/release-package/` and records its SHA256 and npm integrity in `package-verification.json` there. Publish that archive after the complete gate passes. Re-run verification if source, package metadata or packaged documentation changes.
|
|
41
|
-
|
|
42
|
-
To inspect the package manually, use the tarball directly. In the repository root:
|
|
43
|
-
|
|
44
|
-
```sh
|
|
45
|
-
npm pack
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
`npm pack` runs the build and `npm run notices` through `prepack` first, producing `dist-library/` and `THIRD_PARTY_NOTICES.md`. `dist-library/` is the directory targeted by `exports` in `package.json`. Then verify installation in an empty directory:
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
mkdir /tmp/reactive-md-consumer
|
|
52
|
-
cd /tmp/reactive-md-consumer
|
|
53
|
-
npm init -y
|
|
54
|
-
npm install /path/to/reactive-md-0.
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
The core entry can be checked directly in Node:
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
node --input-type=module -e "import { compileLocal, LOCAL_SYNTAX_VERSION } from 'reactive-md'; console.log(LOCAL_SYNTAX_VERSION, compileLocal('# ok').ok)"
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
The React entry requires React 19 to be installed separately:
|
|
64
|
-
|
|
65
|
-
```sh
|
|
66
|
-
npm install react@19 react-dom@19
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
```tsx
|
|
70
|
-
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
71
|
-
import 'reactive-md/styles.css';
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
1
|
+
# Release checklist
|
|
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.
|
|
4
|
+
|
|
5
|
+
## Before release
|
|
6
|
+
|
|
7
|
+
### Package identity and metadata
|
|
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.
|
|
10
|
+
|
|
11
|
+
1. Keep `reactive-md` unless maintainers explicitly decide on a scoped rename. A scope requires the corresponding npm account or organization permissions.
|
|
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
|
+
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
|
+
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
|
+
|
|
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`.
|
|
17
|
+
|
|
18
|
+
### Third-party notices
|
|
19
|
+
|
|
20
|
+
The library bundles `remark-gfm@4.0.1`, `remark-parse@11.0.0`, `unified@11.0.5` and their dependencies. The standalone HTML runtime also bundles React, React DOM and scheduler; the library React entry uses host-provided peers. All these bundles retain the installed dependencies' copyright and license notices in `THIRD_PARTY_NOTICES.md`.
|
|
21
|
+
|
|
22
|
+
Before releasing, maintainers:
|
|
23
|
+
|
|
24
|
+
1. Run `npm run notices` to regenerate `THIRD_PARTY_NOTICES.md` from installed dependencies. The generation script covers the dependency trees and actual license texts of `remark-gfm`, `remark-parse`, `unified`, `react` and `react-dom`, including scheduler.
|
|
25
|
+
2. Confirm `files` in `package.json` includes `THIRD_PARTY_NOTICES.md` so it ships in the tarball.
|
|
26
|
+
3. Inspect the output of `npm pack --dry-run` and confirm there is no `node_modules`, `demo/`, `demo/artifacts/`, test output or local cache.
|
|
27
|
+
4. Check that dependency licenses match the packaged content; regenerate notices after adding or upgrading Markdown dependencies.
|
|
28
|
+
|
|
29
|
+
## Local tarball installation
|
|
30
|
+
|
|
31
|
+
The complete local gate is:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm ci
|
|
35
|
+
npm run verify:release
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`verify:release` runs the Node-side and browser checks, builds the package, installs the real tarball outside the repository and exercises combined document behavior. It manages the preview server and browser lifecycle itself. The gate also covers the editor entry, its stylesheet and two editor instances on one page. CI splits the same gate with `verify:release:node` and `verify:release:browser`. A browser must already be installed locally.
|
|
39
|
+
|
|
40
|
+
The packed check retains the exact verified archive in `artifacts/release-package/` and records its SHA256 and npm integrity in `package-verification.json` there. Publish that archive after the complete gate passes. Re-run verification if source, package metadata or packaged documentation changes.
|
|
41
|
+
|
|
42
|
+
To inspect the package manually, use the tarball directly. In the repository root:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm pack
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`npm pack` runs the build and `npm run notices` through `prepack` first, producing `dist-library/` and `THIRD_PARTY_NOTICES.md`. `dist-library/` is the directory targeted by `exports` in `package.json`. Then verify installation in an empty directory:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
mkdir /tmp/reactive-md-consumer
|
|
52
|
+
cd /tmp/reactive-md-consumer
|
|
53
|
+
npm init -y
|
|
54
|
+
npm install /path/to/reactive-md-0.5.0.tgz
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The core entry can be checked directly in Node:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
node --input-type=module -e "import { compileLocal, LOCAL_SYNTAX_VERSION } from 'reactive-md'; console.log(LOCAL_SYNTAX_VERSION, compileLocal('# ok').ok)"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The React entry requires React 19 to be installed separately:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
npm install react@19 react-dom@19
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
71
|
+
import 'reactive-md/styles.css';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The editor entry uses the same React peer and a separate stylesheet:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { ReactiveMarkdownEditor } from 'reactive-md/editor';
|
|
78
|
+
import 'reactive-md/editor/styles.css';
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Static SSR rendering is covered by the packed check. The editor entry is imported in the server-render check and exercised in the browser check. Single-file export static-first hydration is covered by the Playwright Chromium and local Edge browser checks; general SSR hydration outside that path is unverified. Installation verification should also confirm that the tarball contains complete `dist-library/types`, including the editor entry and stylesheet, `dist-standalone`, `bin`, `cli`, `README.md`, `README-en.md`, `README-ch.md`, `CHANGELOG.md`, `SECURITY.md`, `THIRD_PARTY_NOTICES.md`, `docs` and `examples`, and check that `docs` contains no local links to unpackaged `demo/`, `src/`, `tests/` or `.tasks/` files.
|
|
82
|
+
|
|
83
|
+
## Release notes
|
|
84
|
+
|
|
85
|
+
Release notes are for users and must include at least:
|
|
86
|
+
|
|
87
|
+
- The package version, `LOCAL_SYNTAX_VERSION`, component protocol revision and theme protocol revision; these are different version numbers.
|
|
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.
|
|
90
|
+
- Verified platforms, plus unverified browsers, general SSR hydration and other scope.
|
|
91
|
+
- Known limitations and a link to [SECURITY.md](../SECURITY.md).
|
|
92
|
+
|
|
93
|
+
Do not write results for checks that have not run, and do not present the existence of CI configuration as CI passing.
|
|
94
|
+
|
|
95
|
+
## Manual release checklist
|
|
96
|
+
|
|
97
|
+
1. Confirm the working tree is clean, changes have been reviewed, and `npm ci` installs successfully from the lockfile.
|
|
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.
|
|
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
|
+
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
|
+
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`.
|
|
105
|
+
9. Verify the package contents, version, README, license and release notes on npm and GitHub Releases; reinstall once from the public registry.
|
|
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
|
+
|
|
108
|
+
The version and install command in the README should be ready before packaging and verified after release. Do not commit tokens, `.npmrc` credentials or local paths during the release process.
|
|
@@ -191,8 +191,10 @@ IIFE 会注册一个 Light DOM 自定义元素。简单选项通过属性传递
|
|
|
191
191
|
|
|
192
192
|
| 产物 | 当前基线 | 报警阈值 |
|
|
193
193
|
| --- | --- | --- |
|
|
194
|
-
| `reactive-md-standalone.js` | 约
|
|
195
|
-
| `reactive-md-standalone.css` | 约
|
|
194
|
+
| `reactive-md-standalone.js` | 约 925 kB(gzip 约 276 kB) | 1024 KiB / gzip 320 KiB |
|
|
195
|
+
| `reactive-md-standalone.css` | 约 81.2 kB(gzip 约 13.5 kB) | 80 KiB / gzip 20 KiB |
|
|
196
|
+
|
|
197
|
+
0.5 基线包含语法高亮器和常见语言语法,离线文件也能高亮。
|
|
196
198
|
|
|
197
199
|
数值会随压缩器和 React 补丁版本小幅变化。阈值远高于正常波动,同时能捕获 React 或渲染器被重复打包的退化。完整 HTML 还包含源码、notices 和内联图片,因此会大于这个基线。
|
|
198
200
|
|
|
@@ -193,8 +193,10 @@ The element uses Light DOM so the existing document CSS, heading anchors and pri
|
|
|
193
193
|
|
|
194
194
|
| Artifact | Current baseline | Alarm |
|
|
195
195
|
| --- | --- | --- |
|
|
196
|
-
| `reactive-md-standalone.js` | ≈
|
|
197
|
-
| `reactive-md-standalone.css` | ≈
|
|
196
|
+
| `reactive-md-standalone.js` | ≈925 kB (≈276 kB gzip) | 1024 KiB / 320 KiB gzip |
|
|
197
|
+
| `reactive-md-standalone.css` | ≈81.2 kB (≈13.5 kB gzip) | 80 KiB / 20 KiB gzip |
|
|
198
|
+
|
|
199
|
+
The 0.5 baseline includes the syntax highlighter and common language grammars for offline use.
|
|
198
200
|
|
|
199
201
|
Sizes vary slightly with the minifier and React patch release. The alarm is intentionally well above normal noise while catching a React or renderer duplication regression. The full generated HTML also contains the source, notices and inline images, so it is larger than this baseline.
|
|
200
202
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "reactive-md-core-example",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"engines": { "node": ">=22.12.0" },
|
|
6
|
-
"scripts": { "start": "node index.mjs" }
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "reactive-md-core-example",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"engines": { "node": ">=22.12.0" },
|
|
6
|
+
"scripts": { "start": "node index.mjs" }
|
|
7
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Reactive MD integration</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<div id="root"></div>
|
|
10
|
-
<script type="module" src="/main.jsx"></script>
|
|
11
|
-
</body>
|
|
12
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Reactive MD integration</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/main.jsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
4
|
-
import 'reactive-md/styles.css';
|
|
5
|
-
|
|
6
|
-
const source = `# Cost estimate
|
|
7
|
-
|
|
8
|
-
<panel title="Adjust the plan">
|
|
9
|
-
<slider bind="people" label="People" initial="2" min="1" max="20">
|
|
10
|
-
<toggle bind="annual" label="Annual billing">
|
|
11
|
-
</panel>
|
|
12
|
-
|
|
13
|
-
Monthly cost: **{{ people * (annual ? 80 : 100) }} USD**.`;
|
|
14
|
-
|
|
15
|
-
createRoot(document.getElementById('root')).render(
|
|
16
|
-
<React.StrictMode>
|
|
17
|
-
<main style={{ padding: 24 }}>
|
|
18
|
-
<LocalReactiveDocument source={source} />
|
|
19
|
-
</main>
|
|
20
|
-
</React.StrictMode>,
|
|
21
|
-
);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
4
|
+
import 'reactive-md/styles.css';
|
|
5
|
+
|
|
6
|
+
const source = `# Cost estimate
|
|
7
|
+
|
|
8
|
+
<panel title="Adjust the plan">
|
|
9
|
+
<slider bind="people" label="People" initial="2" min="1" max="20">
|
|
10
|
+
<toggle bind="annual" label="Annual billing">
|
|
11
|
+
</panel>
|
|
12
|
+
|
|
13
|
+
Monthly cost: **{{ people * (annual ? 80 : 100) }} USD**.`;
|
|
14
|
+
|
|
15
|
+
createRoot(document.getElementById('root')).render(
|
|
16
|
+
<React.StrictMode>
|
|
17
|
+
<main style={{ padding: 24 }}>
|
|
18
|
+
<LocalReactiveDocument source={source} />
|
|
19
|
+
</main>
|
|
20
|
+
</React.StrictMode>,
|
|
21
|
+
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "reactive-md-react-example",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"engines": { "node": ">=22.12.0" },
|
|
6
|
-
"scripts": { "dev": "vite --host 127.0.0.1", "build": "vite build" },
|
|
7
|
-
"dependencies": { "react": "^19.0.0", "react-dom": "^19.0.0" },
|
|
8
|
-
"devDependencies": { "vite": "^8.3.5" }
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "reactive-md-react-example",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"engines": { "node": ">=22.12.0" },
|
|
6
|
+
"scripts": { "dev": "vite --host 127.0.0.1", "build": "vite build" },
|
|
7
|
+
"dependencies": { "react": "^19.0.0", "react-dom": "^19.0.0" },
|
|
8
|
+
"devDependencies": { "vite": "^8.3.5" }
|
|
9
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { compileLocal } from 'reactive-md';
|
|
3
|
+
import {
|
|
4
|
+
ReactiveMarkdownEditor,
|
|
5
|
+
type ReactiveMarkdownEditorHandle,
|
|
6
|
+
} from 'reactive-md/editor';
|
|
7
|
+
import 'reactive-md/editor/styles.css';
|
|
8
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
9
|
+
import 'reactive-md/styles.css';
|
|
10
|
+
|
|
11
|
+
const documents = {
|
|
12
|
+
estimate: `# Cost estimate
|
|
13
|
+
|
|
14
|
+
<panel title="Adjust the plan">
|
|
15
|
+
<slider bind="people" label="People" initial="2" min="1" max="20">
|
|
16
|
+
<toggle bind="annual" label="Annual billing">
|
|
17
|
+
</panel>
|
|
18
|
+
|
|
19
|
+
Monthly cost: **{{ people * (annual ? 80 : 100) }} USD**.`,
|
|
20
|
+
notes: `# Notes
|
|
21
|
+
|
|
22
|
+
Write Markdown here. The source stays in React state.
|
|
23
|
+
|
|
24
|
+
- The editor owns formatting and undo history.
|
|
25
|
+
- The host owns compilation, preview and saving.`,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type DocumentId = keyof typeof documents;
|
|
29
|
+
|
|
30
|
+
export function SourceAndPreview() {
|
|
31
|
+
const [documentId, setDocumentId] = useState<DocumentId>('estimate');
|
|
32
|
+
const [source, setSource] = useState(documents.estimate);
|
|
33
|
+
const editor = useRef<ReactiveMarkdownEditorHandle>(null);
|
|
34
|
+
const result = useMemo(() => compileLocal(source), [source]);
|
|
35
|
+
|
|
36
|
+
function openDocument(id: DocumentId) {
|
|
37
|
+
setDocumentId(id);
|
|
38
|
+
setSource(documents[id]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div style={{ display: 'grid', gap: 16 }}>
|
|
43
|
+
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
|
|
44
|
+
<button type="button" onClick={() => openDocument('estimate')}>Estimate</button>
|
|
45
|
+
<button type="button" onClick={() => openDocument('notes')}>Notes</button>
|
|
46
|
+
<button type="button" onClick={() => editor.current?.undo()}>Undo</button>
|
|
47
|
+
<button type="button" onClick={() => editor.current?.redo()}>Redo</button>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<ReactiveMarkdownEditor
|
|
51
|
+
ref={editor}
|
|
52
|
+
value={source}
|
|
53
|
+
onChange={setSource}
|
|
54
|
+
documentKey={documentId}
|
|
55
|
+
diagnostics={result.diagnostics}
|
|
56
|
+
document={result.ok ? result.document : null}
|
|
57
|
+
ariaLabel="Reactive MD source"
|
|
58
|
+
onExport={() => {
|
|
59
|
+
const blob = new Blob([source], { type: 'text/markdown;charset=utf-8' });
|
|
60
|
+
const url = URL.createObjectURL(blob);
|
|
61
|
+
const link = document.createElement('a');
|
|
62
|
+
link.href = url;
|
|
63
|
+
link.download = `${documentId}.reactive.md`;
|
|
64
|
+
link.click();
|
|
65
|
+
URL.revokeObjectURL(url);
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
{result.ok
|
|
70
|
+
? <LocalReactiveDocument source={source} />
|
|
71
|
+
: <pre>{result.diagnostics.map(item => `${item.line}:${item.column} ${item.message}`).join('\n')}</pre>}
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# Find components in the document
|
|
2
|
-
|
|
3
|
-
Type "visual", "input" or another keyword into the search box above the table. Click a column name to sort, and use the paging controls to move between pages.
|
|
4
|
-
|
|
5
|
-
<panel title="Local component catalog">
|
|
6
|
-
<table label="Component catalog" page-size="4">
|
|
7
|
-
| Name | Category | Purpose |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
| slider | Input | Drag to adjust a number |
|
|
10
|
-
| toggle | Input | Flip a switch |
|
|
11
|
-
| choices | Input | Pick from a few options |
|
|
12
|
-
| chart | Visual | Turn a Markdown table into a chart |
|
|
13
|
-
| plot | Visual | Draw a function with LaTeX |
|
|
14
|
-
| diagram | Visual | Select nodes to explore explanations |
|
|
15
|
-
| checklist | Content | Tick off completed items |
|
|
16
|
-
| timer | Utility | Start, pause and reset a countdown |
|
|
17
|
-
</table>
|
|
18
|
-
</panel>
|
|
19
|
-
|
|
20
|
-
The catalog data lives in this document. Searching filters the table directly, and restoring the defaults clears the query and returns to the original order.
|
|
1
|
+
# Find components in the document
|
|
2
|
+
|
|
3
|
+
Type "visual", "input" or another keyword into the search box above the table. Click a column name to sort, and use the paging controls to move between pages.
|
|
4
|
+
|
|
5
|
+
<panel title="Local component catalog">
|
|
6
|
+
<table label="Component catalog" page-size="4">
|
|
7
|
+
| Name | Category | Purpose |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| slider | Input | Drag to adjust a number |
|
|
10
|
+
| toggle | Input | Flip a switch |
|
|
11
|
+
| choices | Input | Pick from a few options |
|
|
12
|
+
| chart | Visual | Turn a Markdown table into a chart |
|
|
13
|
+
| plot | Visual | Draw a function with LaTeX |
|
|
14
|
+
| diagram | Visual | Select nodes to explore explanations |
|
|
15
|
+
| checklist | Content | Tick off completed items |
|
|
16
|
+
| timer | Utility | Start, pause and reset a countdown |
|
|
17
|
+
</table>
|
|
18
|
+
</panel>
|
|
19
|
+
|
|
20
|
+
The catalog data lives in this document. Searching filters the table directly, and restoring the defaults clears the query and returns to the original order.
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
# Organize a walkthrough with a checklist
|
|
2
|
-
|
|
3
|
-
<panel title="Walkthrough checklist">
|
|
4
|
-
<checklist bind="done" label="Complete these steps">
|
|
5
|
-
- [x] Read the source document
|
|
6
|
-
- [ ] Adjust parameters and watch the results
|
|
7
|
-
- [ ] Try it at phone width
|
|
8
|
-
</checklist>
|
|
9
|
-
|
|
10
|
-
Done: **{{ len(done) }} / 3**.
|
|
11
|
-
|
|
12
|
-
<progress label="Completion" value="{{ len(done) / 3 * 100 }}">
|
|
13
|
-
|
|
14
|
-
<if when="{{ len(done) == 3 }}">
|
|
15
|
-
<alert tone="success" title="Walkthrough complete">
|
|
16
|
-
You have read the source, tried the interactions and checked the narrow layout.
|
|
17
|
-
</alert>
|
|
18
|
-
</if>
|
|
19
|
-
</panel>
|
|
20
|
-
|
|
21
|
-
## Search, sorting and paging
|
|
22
|
-
|
|
23
|
-
<table label="Component price examples" page-size="3">
|
|
24
|
-
| Name | Category | Price |
|
|
25
|
-
| --- | --- | ---: |
|
|
26
|
-
| Document | Basic | 20 |
|
|
27
|
-
| Parameter panel | Input | 45 |
|
|
28
|
-
| Chart | Visual | 80 |
|
|
29
|
-
| Diagram | Visual | 65 |
|
|
30
|
-
| Checklist | Basic | 30 |
|
|
31
|
-
| Plan | Utility | 35 |
|
|
32
|
-
</table>
|
|
1
|
+
# Organize a walkthrough with a checklist
|
|
2
|
+
|
|
3
|
+
<panel title="Walkthrough checklist">
|
|
4
|
+
<checklist bind="done" label="Complete these steps">
|
|
5
|
+
- [x] Read the source document
|
|
6
|
+
- [ ] Adjust parameters and watch the results
|
|
7
|
+
- [ ] Try it at phone width
|
|
8
|
+
</checklist>
|
|
9
|
+
|
|
10
|
+
Done: **{{ len(done) }} / 3**.
|
|
11
|
+
|
|
12
|
+
<progress label="Completion" value="{{ len(done) / 3 * 100 }}">
|
|
13
|
+
|
|
14
|
+
<if when="{{ len(done) == 3 }}">
|
|
15
|
+
<alert tone="success" title="Walkthrough complete">
|
|
16
|
+
You have read the source, tried the interactions and checked the narrow layout.
|
|
17
|
+
</alert>
|
|
18
|
+
</if>
|
|
19
|
+
</panel>
|
|
20
|
+
|
|
21
|
+
## Search, sorting and paging
|
|
22
|
+
|
|
23
|
+
<table label="Component price examples" page-size="3">
|
|
24
|
+
| Name | Category | Price |
|
|
25
|
+
| --- | --- | ---: |
|
|
26
|
+
| Document | Basic | 20 |
|
|
27
|
+
| Parameter panel | Input | 45 |
|
|
28
|
+
| Chart | Visual | 80 |
|
|
29
|
+
| Diagram | Visual | 65 |
|
|
30
|
+
| Checklist | Basic | 30 |
|
|
31
|
+
| Plan | Utility | 35 |
|
|
32
|
+
</table>
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
# Side by side, easier to compare
|
|
2
|
-
|
|
3
|
-
<panel title="Payment method">
|
|
4
|
-
<toggle bind="annual" label="Pay annually and save 20%">
|
|
5
|
-
</panel>
|
|
6
|
-
|
|
7
|
-
<grid>
|
|
8
|
-
<card title="Basic plan">
|
|
9
|
-
For individuals and small projects.
|
|
10
|
-
|
|
11
|
-
**{{ annual ? 80 : 100 }} USD per month**.
|
|
12
|
-
|
|
13
|
-
<badge>Local documents</badge>
|
|
14
|
-
</card>
|
|
15
|
-
|
|
16
|
-
<card title="Pro plan">
|
|
17
|
-
For teams that need collaboration and room to grow.
|
|
18
|
-
|
|
19
|
-
**{{ annual ? 160 : 200 }} USD per month**.
|
|
20
|
-
|
|
21
|
-
<badge tone="success">More components</badge>
|
|
22
|
-
</card>
|
|
23
|
-
</grid>
|
|
24
|
-
|
|
25
|
-
<tabs label="Plan details">
|
|
26
|
-
<tab label="Feature comparison">
|
|
27
|
-
| Capability | Basic plan | Pro plan |
|
|
28
|
-
| --- | --- | --- |
|
|
29
|
-
| Parameter adjustment | Included | Included |
|
|
30
|
-
| Text binding | Included | Included |
|
|
31
|
-
| Content organization | Basic layout | Charts and diagrams |
|
|
32
|
-
</tab>
|
|
33
|
-
|
|
34
|
-
<tab label="Buying advice">
|
|
35
|
-
Choose a plan for what you need, then compare how the billing cycle changes the cost.
|
|
36
|
-
</tab>
|
|
37
|
-
</tabs>
|
|
38
|
-
|
|
39
|
-
<accordion>
|
|
40
|
-
<disclosure label="How is the cost calculated?">
|
|
41
|
-
Annual billing applies a 20% discount to the monthly list price, and the equivalent monthly cost is shown above.
|
|
42
|
-
</disclosure>
|
|
43
|
-
|
|
44
|
-
<disclosure label="Can I switch at any time?">
|
|
45
|
-
Toggle the switch above to compare the two billing cycles. This is a local calculation example.
|
|
46
|
-
</disclosure>
|
|
47
|
-
</accordion>
|
|
1
|
+
# Side by side, easier to compare
|
|
2
|
+
|
|
3
|
+
<panel title="Payment method">
|
|
4
|
+
<toggle bind="annual" label="Pay annually and save 20%">
|
|
5
|
+
</panel>
|
|
6
|
+
|
|
7
|
+
<grid>
|
|
8
|
+
<card title="Basic plan">
|
|
9
|
+
For individuals and small projects.
|
|
10
|
+
|
|
11
|
+
**{{ annual ? 80 : 100 }} USD per month**.
|
|
12
|
+
|
|
13
|
+
<badge>Local documents</badge>
|
|
14
|
+
</card>
|
|
15
|
+
|
|
16
|
+
<card title="Pro plan">
|
|
17
|
+
For teams that need collaboration and room to grow.
|
|
18
|
+
|
|
19
|
+
**{{ annual ? 160 : 200 }} USD per month**.
|
|
20
|
+
|
|
21
|
+
<badge tone="success">More components</badge>
|
|
22
|
+
</card>
|
|
23
|
+
</grid>
|
|
24
|
+
|
|
25
|
+
<tabs label="Plan details">
|
|
26
|
+
<tab label="Feature comparison">
|
|
27
|
+
| Capability | Basic plan | Pro plan |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| Parameter adjustment | Included | Included |
|
|
30
|
+
| Text binding | Included | Included |
|
|
31
|
+
| Content organization | Basic layout | Charts and diagrams |
|
|
32
|
+
</tab>
|
|
33
|
+
|
|
34
|
+
<tab label="Buying advice">
|
|
35
|
+
Choose a plan for what you need, then compare how the billing cycle changes the cost.
|
|
36
|
+
</tab>
|
|
37
|
+
</tabs>
|
|
38
|
+
|
|
39
|
+
<accordion>
|
|
40
|
+
<disclosure label="How is the cost calculated?">
|
|
41
|
+
Annual billing applies a 20% discount to the monthly list price, and the equivalent monthly cost is shown above.
|
|
42
|
+
</disclosure>
|
|
43
|
+
|
|
44
|
+
<disclosure label="Can I switch at any time?">
|
|
45
|
+
Toggle the switch above to compare the two billing cycles. This is a local calculation example.
|
|
46
|
+
</disclosure>
|
|
47
|
+
</accordion>
|