reactive-md 0.6.0 → 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 (105) hide show
  1. package/CHANGELOG-ch.md +203 -194
  2. package/CHANGELOG.md +203 -194
  3. package/CONTRIBUTING-ch.md +67 -67
  4. package/CONTRIBUTING.md +69 -69
  5. package/README-ch.md +157 -157
  6. package/README-en.md +184 -184
  7. package/README.md +184 -184
  8. package/SECURITY-ch.md +81 -81
  9. package/SECURITY.md +81 -81
  10. package/THIRD_PARTY_NOTICES.md +313 -209
  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-DSC0VsNK.js → authoring-BEVyth5X.js} +1 -1
  25. package/dist-library/compiler-Cm3ppMxG.js +46044 -0
  26. package/dist-library/{react-Dk94rcOp.js → react-Bh7_oxZp.js} +20110 -20113
  27. package/dist-library/reactive-md-authoring.js +2 -2
  28. package/dist-library/reactive-md-print.css +284 -284
  29. package/dist-library/reactive-md-react-unstyled.js +1 -1
  30. package/dist-library/reactive-md-react.js +1 -1
  31. package/dist-library/reactive-md.css +1 -1
  32. package/dist-library/reactive-md.js +3 -3
  33. package/dist-library/{runtime-D8KbnCd0.js → runtime-DlFYQ4s_.js} +1 -1
  34. package/dist-library/types/local/math-display.d.ts +22 -23
  35. package/dist-library/types/local/math-view.d.ts +6 -7
  36. package/dist-standalone/reactive-md-standalone.css +1 -1
  37. package/dist-standalone/reactive-md-standalone.js +318 -62
  38. package/docs/compatibility/compatibility-ch.md +121 -119
  39. package/docs/compatibility/compatibility-en.md +121 -119
  40. package/docs/compatibility/source-versioning-ch.md +159 -159
  41. package/docs/compatibility/source-versioning-en.md +159 -159
  42. package/docs/development/component-development-ch.md +210 -210
  43. package/docs/development/component-development-en.md +210 -210
  44. package/docs/development/component-protocol-ch.md +747 -747
  45. package/docs/development/component-protocol-en.md +747 -747
  46. package/docs/development/performance-ch.md +76 -76
  47. package/docs/development/performance-en.md +76 -76
  48. package/docs/development/releasing-ch.md +108 -108
  49. package/docs/development/releasing-en.md +108 -108
  50. package/docs/integration/author-tools-ch.md +62 -62
  51. package/docs/integration/author-tools-en.md +62 -62
  52. package/docs/integration/shareable-export-ch.md +209 -209
  53. package/docs/integration/shareable-export-en.md +211 -211
  54. package/docs/reference/computations-formatting-ch.md +87 -87
  55. package/docs/reference/computations-formatting-en.md +87 -87
  56. package/docs/reference/constraints-collections-ch.md +84 -84
  57. package/docs/reference/constraints-collections-en.md +84 -84
  58. package/docs/reference/diagnostics-counting-ch.md +104 -104
  59. package/docs/reference/diagnostics-counting-en.md +104 -104
  60. package/docs/reference/local-components-v2-ch.md +138 -138
  61. package/docs/reference/local-components-v2-en.md +104 -104
  62. package/docs/reference/local-interaction-syntax-ch.md +515 -511
  63. package/docs/reference/local-interaction-syntax-en.md +511 -507
  64. package/docs/reference/theme-protocol-ch.md +107 -107
  65. package/docs/reference/theme-protocol-en.md +107 -107
  66. package/docs/releases/release-0.4.0-ch.md +89 -89
  67. package/docs/releases/release-0.4.0-en.md +89 -89
  68. package/docs/releases/release-0.4.1-ch.md +23 -23
  69. package/docs/releases/release-0.4.1-en.md +23 -23
  70. package/docs/releases/release-0.6.1-ch.md +27 -0
  71. package/docs/releases/release-0.6.1-en.md +27 -0
  72. package/examples/conformance/README.md +53 -53
  73. package/examples/conformance/component-protocol-1.json +482 -482
  74. package/examples/conformance/component-protocol-1.schema.json +76 -76
  75. package/examples/conformance/local-draft-1.json +50 -50
  76. package/examples/conformance/local-draft-2.json +212 -212
  77. package/examples/integration/README.md +47 -47
  78. package/examples/integration/core/index.mjs +32 -32
  79. package/examples/integration/worker/index.html +19 -19
  80. package/examples/integration/worker/main.js +61 -61
  81. package/examples/integration/worker/package.json +13 -13
  82. package/examples/integration/worker/worker.js +3 -3
  83. package/examples/local/README.md +74 -74
  84. package/examples/local/charts.reactive.md +73 -73
  85. package/examples/local/recipes/invoice-zh.reactive.md +36 -36
  86. package/examples/local/recipes/invoice.reactive.md +36 -36
  87. package/examples/local/recipes/workshop-zh.reactive.md +33 -33
  88. package/examples/local/recipes/workshop.reactive.md +33 -33
  89. package/examples/local/showcase/README.md +25 -25
  90. package/examples/local/showcase/explore.reactive.md +102 -102
  91. package/examples/local/showcase/flow.reactive.md +86 -86
  92. package/examples/local/showcase/forms.reactive.md +126 -126
  93. package/examples/local/showcase/functions.reactive.md +119 -119
  94. package/examples/local/showcase/layout.reactive.md +100 -100
  95. package/examples/local/showcase/statistics.reactive.md +108 -108
  96. package/examples/local/showcase/tasks.reactive.md +89 -89
  97. package/examples/local/showcase/zh/explore.reactive.md +102 -102
  98. package/examples/local/showcase/zh/flow.reactive.md +86 -86
  99. package/examples/local/showcase/zh/forms.reactive.md +126 -126
  100. package/examples/local/showcase/zh/functions.reactive.md +119 -119
  101. package/examples/local/showcase/zh/layout.reactive.md +100 -100
  102. package/examples/local/showcase/zh/statistics.reactive.md +108 -108
  103. package/examples/local/showcase/zh/tasks.reactive.md +89 -89
  104. package/package.json +152 -152
  105. package/dist-library/compiler-CRD88BMt.js +0 -24964
@@ -1,108 +1,108 @@
1
- # Release checklist
2
-
3
- This file is the maintainers' manual release process. This checklist covers `0.6.0`, which updates both `latest` and `next`. See [Versions and compatibility](../compatibility/compatibility-en.md) for version rules and the [0.6.0 release notes](../releases/release-0.6.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`; `0.5.1` through `0.6.0` keep those entries. Do not treat a rename as routine release preparation: changing the name is a breaking change for imports, state tooling and documentation.
10
-
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.6.0` is `reactive-md-0.6.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`, `elkjs@0.12.0`, `mhchemparser@4.2.1` 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`, `parse5`, `lowlight`, `elkjs`, `mhchemparser`, `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.6.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`, `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.6.0 release notes](../releases/release-0.6.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.6.0` adds native HTML tables, expanded math and code highlighting, layered diagrams and host fixes; syntax revision `local-draft-2`, component protocol `component-protocol-2` and theme protocol `reactive-md-theme-1` are unchanged. 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.6.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 tarball manually: `npm publish artifacts/release-package/reactive-md-0.6.0.tgz --access public --tag next`. Preview releases start on `next`. This release is authorized to update the default version too, so after publication run `npm dist-tag add reactive-md@0.6.0 latest` and query dist-tags again to confirm both channels. If `latest` is not in scope, keep the existing default version.
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.
1
+ # Release checklist
2
+
3
+ This file is the maintainers' manual release process. This checklist covers `0.6.1`, which updates both `latest` and `next`. See [Versions and compatibility](../compatibility/compatibility-en.md) for version rules and the [0.6.1 release notes](../releases/release-0.6.1-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`; `0.5.1` through `0.6.1` keep those entries. Do not treat a rename as routine release preparation: changing the name is a breaking change for imports, state tooling and documentation.
10
+
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.6.1` is `reactive-md-0.6.1.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`, `elkjs@0.12.0`, `katex@0.19.1` and their dependencies. KaTeX includes math fonts and the mhchem extension. The standalone HTML runtime also bundles React, React DOM and scheduler; the library React entry uses host-provided peers. All these bundles retain their 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 script covers `remark-gfm`, `remark-parse`, `unified`, `parse5`, `lowlight`, `elkjs`, `katex`, `react` and `react-dom`, including scheduler, plus the upstream mhchem attribution and Apache-2.0 license.
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.6.1.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`, `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.6.1 release notes](../releases/release-0.6.1-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.6.1` switches formula display to KaTeX with bundled math fonts; syntax revision `local-draft-2`, component protocol `component-protocol-2` and theme protocol `reactive-md-theme-1` are unchanged. 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.6.1`. Do not store npm tokens in an automated release workflow.
104
+ 8. Attach the verified tarball, `package-verification.json` and a `release-manifest.json` containing `version`, source `commit`, `sha256` and `integrity` to a draft GitHub Release for the tag. Trigger `publish.yml` with `ref=v0.6.1`, `dist_tag=next`, `update_latest=true` and `use_verified_release=true`. npm trusted publishing uses OIDC; local npm login and OTP are not required. The workflow validates the source commit and archive hashes before publishing the attached file. Wait for success and confirm both dist-tags. When `latest` is outside the authorized scope, pass `update_latest=false`.
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.
@@ -1,62 +1,62 @@
1
- # 作者工具
2
-
3
- [English](author-tools-en.md)
4
-
5
- 安装 `reactive-md@0.6.0` 即可使用 CLI 和不依赖 React 的 `reactive-md/authoring` 入口。从本仓库开发时,先构建语言包:
6
-
7
- ```sh
8
- npm ci
9
- npm run build
10
- npm run lint -- examples/local/planning.reactive.md
11
- ```
12
-
13
- ## 命令行检查
14
-
15
- 语言包提供 `reactive-md lint`。可以传入多个文件,或用 `-` 读取标准输入:
16
-
17
- ```sh
18
- reactive-md lint "my document.reactive.md" other.reactive.md
19
- reactive-md lint --json --warnings-as-errors document.reactive.md
20
- reactive-md lint --locale zh document.reactive.md
21
- cat document.reactive.md | reactive-md lint -
22
- ```
23
-
24
- 文本输出包含文件、行、列、严重程度和诊断代码。JSON 输出为 `{ file, ok, diagnostics }` 报告数组。诊断沿用编译器的 UTF-16 源码范围,行列从 1 开始。检查过程保留原文件。
25
-
26
- `--locale en|zh` 选择诊断消息语言,默认英文。切换语言保留诊断码、严重程度和位置。兼容契约与预算单位见[诊断与计数规则](../reference/diagnostics-counting-ch.md)。
27
-
28
- | 退出码 | 含义 |
29
- | --- | --- |
30
- | 0 | 没有错误;默认允许警告 |
31
- | 1 | 存在编译错误,或启用 `--warnings-as-errors` 后存在警告 |
32
- | 2 | 参数错误或文件读取失败 |
33
-
34
- ## 接入编辑器
35
-
36
- 核心入口提供与 DOM 无关的函数:
37
-
38
- ```js
39
- import {
40
- analyzeLocalSource, completeLocalSource,
41
- renameLocalBinding, formatLocalSource,
42
- } from 'reactive-md/authoring';
43
-
44
- const analysis = analyzeLocalSource(source, compileOptions);
45
- const suggestions = completeLocalSource(source, cursorOffset, compileOptions);
46
- const renamed = renameLocalBinding(source, 'people', 'attendees', compileOptions);
47
- const formatted = formatLocalSource(renamed.source, compileOptions);
48
- ```
49
-
50
- 分析结果包含按位置排序的高亮 token、绑定声明和引用范围,以及编译诊断。补全项包含 `label`、`kind`、`insertText` 和待替换的 `range`。应用编辑时,应使用生成这些范围的同一版本源码。
51
-
52
- 重命名修改生效的绑定声明、表达式引用和绘图参数,保留普通文字与展示公式。绘图参数在重命名后写为 `\mathrm{newName}`。非法名称和名称冲突会抛出错误。格式化整理已识别组件标签内的空白,保留 Markdown 排版、引号内容、公式、代码与降级区域的源码。编辑器应持续保存原始文档。
53
-
54
- ## Playground
55
-
56
- 运行 `npm run dev`,选择“显示源码”。编辑器提供高亮、补全、绑定定位、重命名、格式化、诊断跳转与实时预览。通过补全按钮或 Ctrl+Space 打开建议列表,方向键选择,Enter 插入,Escape 关闭。重命名与格式化均可撤销、重做。
57
-
58
- ## 宿主编辑器配置
59
-
60
- `reactive-md/authoring` 还导出 `LOCAL_COMPONENTS`、`getLocalComponent`、`getNativeComponentCatalog`、`renderNativeSnippet`、`insertTemplate` 及其类型,无需 React 或 CSS。将预览使用的 `LocalCompileOptions` 作为分析、补全、重命名和格式化的最后一个参数;省略时保持原有默认值。配置包括宿主 schema、HTML 模式、资源预算和 `markdownBreaks`。
61
-
62
- 入口与样式接入方式见 [0.5.3 发布说明](../releases/release-0.5.3-ch.md)。
1
+ # 作者工具
2
+
3
+ [English](author-tools-en.md)
4
+
5
+ 安装 `reactive-md@0.6.0` 即可使用 CLI 和不依赖 React 的 `reactive-md/authoring` 入口。从本仓库开发时,先构建语言包:
6
+
7
+ ```sh
8
+ npm ci
9
+ npm run build
10
+ npm run lint -- examples/local/planning.reactive.md
11
+ ```
12
+
13
+ ## 命令行检查
14
+
15
+ 语言包提供 `reactive-md lint`。可以传入多个文件,或用 `-` 读取标准输入:
16
+
17
+ ```sh
18
+ reactive-md lint "my document.reactive.md" other.reactive.md
19
+ reactive-md lint --json --warnings-as-errors document.reactive.md
20
+ reactive-md lint --locale zh document.reactive.md
21
+ cat document.reactive.md | reactive-md lint -
22
+ ```
23
+
24
+ 文本输出包含文件、行、列、严重程度和诊断代码。JSON 输出为 `{ file, ok, diagnostics }` 报告数组。诊断沿用编译器的 UTF-16 源码范围,行列从 1 开始。检查过程保留原文件。
25
+
26
+ `--locale en|zh` 选择诊断消息语言,默认英文。切换语言保留诊断码、严重程度和位置。兼容契约与预算单位见[诊断与计数规则](../reference/diagnostics-counting-ch.md)。
27
+
28
+ | 退出码 | 含义 |
29
+ | --- | --- |
30
+ | 0 | 没有错误;默认允许警告 |
31
+ | 1 | 存在编译错误,或启用 `--warnings-as-errors` 后存在警告 |
32
+ | 2 | 参数错误或文件读取失败 |
33
+
34
+ ## 接入编辑器
35
+
36
+ 核心入口提供与 DOM 无关的函数:
37
+
38
+ ```js
39
+ import {
40
+ analyzeLocalSource, completeLocalSource,
41
+ renameLocalBinding, formatLocalSource,
42
+ } from 'reactive-md/authoring';
43
+
44
+ const analysis = analyzeLocalSource(source, compileOptions);
45
+ const suggestions = completeLocalSource(source, cursorOffset, compileOptions);
46
+ const renamed = renameLocalBinding(source, 'people', 'attendees', compileOptions);
47
+ const formatted = formatLocalSource(renamed.source, compileOptions);
48
+ ```
49
+
50
+ 分析结果包含按位置排序的高亮 token、绑定声明和引用范围,以及编译诊断。补全项包含 `label`、`kind`、`insertText` 和待替换的 `range`。应用编辑时,应使用生成这些范围的同一版本源码。
51
+
52
+ 重命名修改生效的绑定声明、表达式引用和绘图参数,保留普通文字与展示公式。绘图参数在重命名后写为 `\mathrm{newName}`。非法名称和名称冲突会抛出错误。格式化整理已识别组件标签内的空白,保留 Markdown 排版、引号内容、公式、代码与降级区域的源码。编辑器应持续保存原始文档。
53
+
54
+ ## Playground
55
+
56
+ 运行 `npm run dev`,选择“显示源码”。编辑器提供高亮、补全、绑定定位、重命名、格式化、诊断跳转与实时预览。通过补全按钮或 Ctrl+Space 打开建议列表,方向键选择,Enter 插入,Escape 关闭。重命名与格式化均可撤销、重做。
57
+
58
+ ## 宿主编辑器配置
59
+
60
+ `reactive-md/authoring` 还导出 `LOCAL_COMPONENTS`、`getLocalComponent`、`getNativeComponentCatalog`、`renderNativeSnippet`、`insertTemplate` 及其类型,无需 React 或 CSS。将预览使用的 `LocalCompileOptions` 作为分析、补全、重命名和格式化的最后一个参数;省略时保持原有默认值。配置包括宿主 schema、HTML 模式、资源预算和 `markdownBreaks`。
61
+
62
+ 入口与样式接入方式见 [0.5.3 发布说明](../releases/release-0.5.3-ch.md)。
@@ -1,62 +1,62 @@
1
- # Author tools
2
-
3
- [中文](author-tools-ch.md)
4
-
5
- Install `reactive-md@0.6.0` to use the CLI and the React-free `reactive-md/authoring` entry. To work from this repository, build the package first:
6
-
7
- ```sh
8
- npm ci
9
- npm run build
10
- npm run lint -- examples/local/planning.reactive.md
11
- ```
12
-
13
- ## Command line
14
-
15
- The package provides `reactive-md lint`. Pass one or more document paths, or `-` to read stdin:
16
-
17
- ```sh
18
- reactive-md lint "my document.reactive.md" other.reactive.md
19
- reactive-md lint --json --warnings-as-errors document.reactive.md
20
- reactive-md lint --locale zh document.reactive.md
21
- cat document.reactive.md | reactive-md lint -
22
- ```
23
-
24
- Text output includes the file, line, column, severity and diagnostic code. JSON output is an array of `{ file, ok, diagnostics }` reports. Diagnostics use the compiler's original UTF-16 source ranges and one-based line/column positions. The command reads documents without changing them.
25
-
26
- `--locale en|zh` selects diagnostic messages and defaults to English. Codes, severity and locations stay identical across languages. See [Diagnostics and counting rules](../reference/diagnostics-counting-en.md) for the compatibility contract and budget units.
27
-
28
- | Exit code | Meaning |
29
- | --- | --- |
30
- | 0 | No errors; warnings are allowed by default |
31
- | 1 | Compiler errors, or warnings with `--warnings-as-errors` |
32
- | 2 | Invalid arguments or a file-read failure |
33
-
34
- ## Editor integration
35
-
36
- The core entry exposes DOM-independent functions:
37
-
38
- ```js
39
- import {
40
- analyzeLocalSource, completeLocalSource,
41
- renameLocalBinding, formatLocalSource,
42
- } from 'reactive-md/authoring';
43
-
44
- const analysis = analyzeLocalSource(source, compileOptions);
45
- const suggestions = completeLocalSource(source, cursorOffset, compileOptions);
46
- const renamed = renameLocalBinding(source, 'people', 'attendees', compileOptions);
47
- const formatted = formatLocalSource(renamed.source, compileOptions);
48
- ```
49
-
50
- Analysis returns ordered highlight tokens, bindings with declaration/reference ranges, and compiler diagnostics. Completions contain `label`, `kind`, `insertText` and the `range` to replace. Apply edits against the same source version that produced their ranges.
51
-
52
- Rename updates active binding declarations, expression references and computed plot parameters, preserving literal text and display formulas. Plot parameters use `\mathrm{newName}` after a rename. Invalid names and collisions throw an error. Formatting normalizes spacing inside recognized component tags; Markdown layout, quoted content, formulas, code and fallback regions retain their source. Keep the original source as the editable document.
53
-
54
- ## Playground
55
-
56
- Run `npm run dev` and choose **Show source**. The source editor provides highlighting, completion, binding locations, rename, formatting, diagnostic navigation and a live preview. Use the completion button or Ctrl+Space, arrow keys and Enter to insert a suggestion, and Escape to close the list. Rename and formatting participate in editor undo/redo.
57
-
58
- ## Host editor configuration
59
-
60
- The `reactive-md/authoring` entry also exports `LOCAL_COMPONENTS`, `getLocalComponent`, `getNativeComponentCatalog`, `renderNativeSnippet`, `insertTemplate` and their types. It loads without React or CSS. Pass the preview's `LocalCompileOptions` as the last argument to analysis, completion, rename and formatting; omitted options keep the existing defaults. This includes host schemas, HTML mode, resource limits and `markdownBreaks`.
61
-
62
- For full entry and stylesheet details, see the [0.5.3 release notes](../releases/release-0.5.3-en.md).
1
+ # Author tools
2
+
3
+ [中文](author-tools-ch.md)
4
+
5
+ Install `reactive-md@0.6.0` to use the CLI and the React-free `reactive-md/authoring` entry. To work from this repository, build the package first:
6
+
7
+ ```sh
8
+ npm ci
9
+ npm run build
10
+ npm run lint -- examples/local/planning.reactive.md
11
+ ```
12
+
13
+ ## Command line
14
+
15
+ The package provides `reactive-md lint`. Pass one or more document paths, or `-` to read stdin:
16
+
17
+ ```sh
18
+ reactive-md lint "my document.reactive.md" other.reactive.md
19
+ reactive-md lint --json --warnings-as-errors document.reactive.md
20
+ reactive-md lint --locale zh document.reactive.md
21
+ cat document.reactive.md | reactive-md lint -
22
+ ```
23
+
24
+ Text output includes the file, line, column, severity and diagnostic code. JSON output is an array of `{ file, ok, diagnostics }` reports. Diagnostics use the compiler's original UTF-16 source ranges and one-based line/column positions. The command reads documents without changing them.
25
+
26
+ `--locale en|zh` selects diagnostic messages and defaults to English. Codes, severity and locations stay identical across languages. See [Diagnostics and counting rules](../reference/diagnostics-counting-en.md) for the compatibility contract and budget units.
27
+
28
+ | Exit code | Meaning |
29
+ | --- | --- |
30
+ | 0 | No errors; warnings are allowed by default |
31
+ | 1 | Compiler errors, or warnings with `--warnings-as-errors` |
32
+ | 2 | Invalid arguments or a file-read failure |
33
+
34
+ ## Editor integration
35
+
36
+ The core entry exposes DOM-independent functions:
37
+
38
+ ```js
39
+ import {
40
+ analyzeLocalSource, completeLocalSource,
41
+ renameLocalBinding, formatLocalSource,
42
+ } from 'reactive-md/authoring';
43
+
44
+ const analysis = analyzeLocalSource(source, compileOptions);
45
+ const suggestions = completeLocalSource(source, cursorOffset, compileOptions);
46
+ const renamed = renameLocalBinding(source, 'people', 'attendees', compileOptions);
47
+ const formatted = formatLocalSource(renamed.source, compileOptions);
48
+ ```
49
+
50
+ Analysis returns ordered highlight tokens, bindings with declaration/reference ranges, and compiler diagnostics. Completions contain `label`, `kind`, `insertText` and the `range` to replace. Apply edits against the same source version that produced their ranges.
51
+
52
+ Rename updates active binding declarations, expression references and computed plot parameters, preserving literal text and display formulas. Plot parameters use `\mathrm{newName}` after a rename. Invalid names and collisions throw an error. Formatting normalizes spacing inside recognized component tags; Markdown layout, quoted content, formulas, code and fallback regions retain their source. Keep the original source as the editable document.
53
+
54
+ ## Playground
55
+
56
+ Run `npm run dev` and choose **Show source**. The source editor provides highlighting, completion, binding locations, rename, formatting, diagnostic navigation and a live preview. Use the completion button or Ctrl+Space, arrow keys and Enter to insert a suggestion, and Escape to close the list. Rename and formatting participate in editor undo/redo.
57
+
58
+ ## Host editor configuration
59
+
60
+ The `reactive-md/authoring` entry also exports `LOCAL_COMPONENTS`, `getLocalComponent`, `getNativeComponentCatalog`, `renderNativeSnippet`, `insertTemplate` and their types. It loads without React or CSS. Pass the preview's `LocalCompileOptions` as the last argument to analysis, completion, rename and formatting; omitted options keep the existing defaults. This includes host schemas, HTML mode, resource limits and `markdownBreaks`.
61
+
62
+ For full entry and stylesheet details, see the [0.5.3 release notes](../releases/release-0.5.3-en.md).