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.
Files changed (79) hide show
  1. package/CHANGELOG-ch.md +128 -113
  2. package/CHANGELOG.md +128 -113
  3. package/LICENSE +21 -21
  4. package/README-ch.md +152 -123
  5. package/README-en.md +176 -147
  6. package/README.md +176 -147
  7. package/THIRD_PARTY_NOTICES.md +94 -1
  8. package/bin/reactive-md.mjs +1 -1
  9. package/dist-library/reactive-md-editor.css +2 -0
  10. package/dist-library/reactive-md-editor.js +3710 -0
  11. package/dist-library/reactive-md-react.js +9035 -1558
  12. package/dist-library/reactive-md.css +1 -1
  13. package/dist-library/reactive-md.js +98 -97
  14. package/dist-library/{runtime-D3QTVYaz.js → runtime-DPuMxM_y.js} +1978 -1583
  15. package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +7 -0
  16. package/dist-library/types/editor/editor-commands.d.ts +50 -0
  17. package/dist-library/types/editor/editor-i18n.d.ts +102 -0
  18. package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
  19. package/dist-library/types/editor/extended-native-components.d.ts +58 -0
  20. package/dist-library/types/editor/index.d.ts +9 -0
  21. package/dist-library/types/editor/locale.d.ts +13 -0
  22. package/dist-library/types/editor/native-components.d.ts +47 -0
  23. package/dist-library/types/editor/source-authoring.d.ts +57 -0
  24. package/dist-library/types/editor/types.d.ts +44 -0
  25. package/dist-library/types/editor/use-gutter-metrics.d.ts +5 -0
  26. package/dist-library/types/editor/use-source-history.d.ts +16 -0
  27. package/dist-library/types/local/code-block.d.ts +24 -0
  28. package/dist-library/types/local/footnotes.d.ts +51 -0
  29. package/dist-library/types/local/image-view.d.ts +21 -0
  30. package/dist-library/types/local/types.d.ts +7 -0
  31. package/dist-standalone/reactive-md-standalone.css +1 -1
  32. package/dist-standalone/reactive-md-standalone.js +47 -36
  33. package/docs/compatibility-ch.md +12 -8
  34. package/docs/compatibility-en.md +12 -8
  35. package/docs/component-protocol-ch.md +2 -2
  36. package/docs/component-protocol-en.md +2 -2
  37. package/docs/editor-ch.md +216 -0
  38. package/docs/editor-en.md +216 -0
  39. package/docs/local-guide-ch.md +11 -5
  40. package/docs/local-guide-en.md +11 -5
  41. package/docs/local-interaction-syntax-ch.md +7 -2
  42. package/docs/local-interaction-syntax-en.md +7 -2
  43. package/docs/release-0.4.1-ch.md +23 -23
  44. package/docs/release-0.4.1-en.md +23 -23
  45. package/docs/release-0.5.0-ch.md +41 -0
  46. package/docs/release-0.5.0-en.md +41 -0
  47. package/docs/releasing-ch.md +108 -101
  48. package/docs/releasing-en.md +108 -101
  49. package/docs/shareable-export-ch.md +4 -2
  50. package/docs/shareable-export-en.md +4 -2
  51. package/examples/integration/core/package.json +7 -7
  52. package/examples/integration/react/index.html +12 -12
  53. package/examples/integration/react/main.jsx +21 -21
  54. package/examples/integration/react/package.json +9 -9
  55. package/examples/integration/react-editor.tsx +74 -0
  56. package/examples/local/catalog.reactive.md +20 -20
  57. package/examples/local/checklist.reactive.md +32 -32
  58. package/examples/local/comparison.reactive.md +47 -47
  59. package/examples/local/components.reactive.md +44 -44
  60. package/examples/local/counter.reactive.md +7 -7
  61. package/examples/local/diagnostics.reactive.md +54 -54
  62. package/examples/local/diagram.reactive.md +44 -44
  63. package/examples/local/gallery.reactive.md +61 -61
  64. package/examples/local/parameters.reactive.md +36 -36
  65. package/examples/local/planning.reactive.md +24 -24
  66. package/examples/local/pricing.reactive.md +20 -20
  67. package/examples/local/zh/catalog.reactive.md +20 -20
  68. package/examples/local/zh/charts.reactive.md +73 -73
  69. package/examples/local/zh/checklist.reactive.md +32 -32
  70. package/examples/local/zh/comparison.reactive.md +47 -47
  71. package/examples/local/zh/components.reactive.md +44 -44
  72. package/examples/local/zh/counter.reactive.md +7 -7
  73. package/examples/local/zh/diagnostics.reactive.md +54 -54
  74. package/examples/local/zh/diagram.reactive.md +44 -44
  75. package/examples/local/zh/gallery.reactive.md +61 -61
  76. package/examples/local/zh/parameters.reactive.md +36 -36
  77. package/examples/local/zh/planning.reactive.md +24 -24
  78. package/examples/local/zh/pricing.reactive.md +20 -20
  79. package/package.json +133 -91
@@ -53,7 +53,7 @@
53
53
  | --- | --- |
54
54
  | Markdown 标题、段落、列表、引用、链接、图片 | 原样使用 |
55
55
  | Markdown 表格 | 原样使用;也可以放进 `<table>` 获得搜索和排序 |
56
- | HTML 标签 | 只使用文档列出的组件标签,例如 `<slider>`、`<card>` |
56
+ | HTML 标签 | 使用组件标签,以及无属性的 `<b>`、`<i>`、`<u>`、`<s>`、`<mark>`、`<br>` |
57
57
  | HTML 属性 | 写成 `label="人数"`,属性名小写,值加引号 |
58
58
  | JavaScript 变量 | 用 `bind="people"` 给控件命名 |
59
59
  | 模板字符串 `${...}` | 用 `{{ people * 100 }}` 读取和计算 |
@@ -208,14 +208,20 @@ npm run dev
208
208
  ```
209
209
  ````
210
210
 
211
- HTML 注释 `<!-- ... -->` 会被忽略,不产生组件或变量。原始 HTML 不会作为网页元素执行;请用 Markdown 或对应组件组织内容。结构完整的未知标签会保留为源码文本并给出警告,内部标签和插值也按原文显示。已知组件上的 `style`、事件属性等仍是编译错误。
211
+ HTML 注释 `<!-- ... -->` 会被忽略,不产生组件或变量。正文支持无属性的 `<b>粗体</b>`、`<i>斜体</i>`、`<u>下划线</u>`、`<s>删除线</s>`、`<mark>高亮</mark>` 和 `<br>`(也接受 `<br/>`),这些格式可以嵌套。其他内容使用 Markdown 或对应组件。结构完整的未知标签会保留为源码文本并给出警告,内部标签和插值也按原文显示。事件、`style` 等属性不会获得执行能力。
212
212
 
213
- 脚注目前保留引用标记和定义原文,并给出 `local.footnote.unsupported` 警告。脚注内容中的标签和插值按原文显示。
213
+ 泛型 `Array<T>`、比较式 `x<y` 和货币 `$5`、`$10` 可以直接写在正文中。公式继续使用 `$x^2$`、`$5$` 或 `$$...$$`。单换行仍是 Markdown 软换行;需要硬换行时使用行尾两个空格或 `<br>`。
214
+
215
+ 脚注使用 `正文[^note]` 引用,在独立段落写 `[^note]: 注释内容`。定义支持 Markdown、上述基础 HTML 和缩进续写的多段内容、列表、代码块。脚注按首次引用顺序编号,集中显示在文末;重复引用共用编号,每处都有返回链接。定义可以先于引用,也可以写在容器内。未定义引用保留原文,未引用定义不显示。脚注内的控件标签和 `{{ 插值 }}` 按文字显示,不建立绑定。
214
216
 
215
217
  目录使用普通 Markdown 链接:`[参数说明](#参数说明)` 对应 `## 参数说明`。英文标题按小写和连字符命名,例如 `## Hello World` 对应 `#hello-world`;重复标题追加 `-1`、`-2`。标题中的动态文字按参数初值生成锚点,调整参数后目录仍指向同一个标题。渲染器会为同页的不同文档隔离锚点,无需在源码中添加前缀。
216
218
 
217
219
  缩进只影响可读性:容器内容会按共同缩进量去掉缩进后再解析;代码围栏内部的缩进保持原样。普通正文建议不要额外缩进。
218
220
 
221
+ 在代码围栏后标明 `js`、`ts`、`python`、`json`、`bash`、`html`、`css` 等语言即可获得语法高亮。复制按钮保留代码的全部空格和换行。未知语言及超过 20,000 字符的代码块按纯文本显示。静态渲染保留高亮并省略复制控件,打印时隐藏代码工具栏。
222
+
223
+ 获宿主 `urlPolicy` 放行的图片可点击或通过 Enter、空格放大。关闭按钮、Esc 或遮罩均可返回原图,带链接的图片继续导航到链接目标。图片白名单用法见[宿主接入](local-integration-ch.md#图片与链接策略)。
224
+
219
225
  ### 3.4 和 HTML 的关键差异
220
226
 
221
227
  | HTML 习惯 | Reactive MD 的做法 |
@@ -836,7 +842,7 @@ $$
836
842
  | `if` 条件类型错误 | `when="{{ seats }}"` 得到数字 | 改成 `when="{{ seats >= 5 }}"` |
837
843
  | `on-click` 不属于组件 | 试图写事件处理器 | 删除事件属性,使用组件自带交互 |
838
844
  | HTML 标签显示为源码或报告结构错误 | 写了未知标签或缺少结束标签 | 改用 Markdown 或对应组件,并检查闭合 |
839
- | 脚注显示原文并给出警告 | 尚未支持脚注排版 | 可暂时改成正文注释 |
845
+ | 脚注引用显示原文 | 找不到对应定义 | 检查 `[^note]` 与 `[^note]: 内容` 的标识符 |
840
846
  | 图表出现“20 元”错误 | 数值列混入文本 | 只写数字,单位放表头 |
841
847
  | `edge` 指向不存在的节点 | `to` 的 id 拼错 | 统一节点 id |
842
848
  | 绘图提示不支持积分 | 公式超出首版计算范围 | 换成支持的函数,或只排版不绘图 |
@@ -852,7 +858,7 @@ $$
852
858
 
853
859
  诊断会给出源码位置、严重程度、类别和简短说明,常见的有标签结构、未知语法、绑定、初值、类型、约束、表格、图解和数学问题。
854
860
 
855
- Playground 的左侧编辑器和右侧诊断区会同时定位问题。未知标签和脚注的降级警告保留原文,其他内容与交互继续工作;未知区域内的控件不会建立绑定。标签未闭合、已知组件的非法属性、表达式或绑定错误、资源上限等仍会阻止编译并停用交互。运行时的局部计算错误只影响对应内容,其他部分继续更新。
861
+ Playground 的左侧编辑器和右侧诊断区会同时定位问题。未知标签的降级警告保留原文,其他内容与交互继续工作;未知区域内的控件不会建立绑定。组件标签未闭合、已知组件的非法属性、表达式或绑定错误、资源上限等仍会阻止编译并停用交互。运行时的局部计算错误只影响对应内容,其他部分继续更新。
856
862
 
857
863
  调试时先修第一条错误。后面的报错有时只是第一条错误造成的连锁反应。
858
864
 
@@ -53,7 +53,7 @@ You can think of Reactive MD as Markdown prose plus a small fixed set of HTML-st
53
53
  | --- | --- |
54
54
  | Markdown headings, paragraphs, lists, quotes, links, images | Used as-is |
55
55
  | Markdown tables | Used as-is; you can also put them in `<table>` for search and sorting |
56
- | HTML tags | Use only the component tags listed in the docs, such as `<slider>`, `<card>` |
56
+ | HTML tags | Use component tags and attribute-free `<b>`, `<i>`, `<u>`, `<s>`, `<mark>` and `<br>` |
57
57
  | HTML attributes | Write `label="People"`, lowercase attribute names, quoted values |
58
58
  | JavaScript variables | Name controls with `bind="people"` |
59
59
  | Template strings `${...}` | Read and compute with `{{ people * 100 }}` |
@@ -208,14 +208,20 @@ Current value: {{ example }}.
208
208
  ```
209
209
  ````
210
210
 
211
- HTML comments `<!-- ... -->` are ignored and produce no components or variables. Raw HTML is not executed as web elements; organize content with Markdown or the matching components. Structurally complete unknown tags are kept as source text with a warning, and their inner tags and interpolations are displayed verbatim as well. `style`, event attributes and similar on known components are still compile errors.
211
+ HTML comments `<!-- ... -->` are ignored and produce no components or variables. Prose supports attribute-free `<b>bold</b>`, `<i>italic</i>`, `<u>underline</u>`, `<s>strikethrough</s>`, `<mark>highlight</mark>` and `<br>` (also `<br/>`), including nested formatting. Use Markdown or the matching components for other content. Structurally complete unknown tags are kept as source text with a warning, including their inner tags and interpolations. Event and `style` attributes gain no execution capability.
212
212
 
213
- Footnotes currently preserve the reference marker and definition source and produce a `local.footnote.unsupported` warning. Tags and interpolations inside footnote content are displayed verbatim.
213
+ Generics such as `Array<T>`, comparisons such as `x<y` and currency such as `$5` and `$10` can appear directly in prose. Formulas still use `$x^2$`, `$5$` or `$$...$$`. A single newline remains a Markdown soft break; use two trailing spaces or `<br>` for a hard break.
214
+
215
+ Use `text[^note]` to reference a footnote and `[^note]: Note text` in a separate paragraph to define it. Definitions support Markdown, the basic HTML above, and indented continuation paragraphs, lists and code blocks. Notes appear at the end in first-reference order. Repeated references share a number, with return links to each occurrence. Definitions may precede references or appear inside containers. Undefined references stay literal, and unused definitions stay hidden. Control tags and `{{ interpolations }}` inside definitions remain text and create no bindings.
214
216
 
215
217
  Tables of contents use ordinary Markdown links: `[Parameter description](#parameter-description)` corresponds to `## Parameter description`. English headings are named in lowercase with hyphens, for example `## Hello World` corresponds to `#hello-world`; duplicate headings get `-1`, `-2` appended. Dynamic text in headings generates anchors from initial parameter values, so the table of contents keeps pointing at the same heading after parameters change. The renderer isolates anchors for different documents on the same page, so no prefix is needed in the source.
216
218
 
217
219
  Indentation only affects readability: container content is dedented by the common indentation before parsing; indentation inside code fences is preserved. Plain prose is best left unindented.
218
220
 
221
+ Code fences with a language name, such as `js`, `ts`, `python`, `json`, `bash`, `html` or `css`, receive syntax highlighting. The copy button copies the exact code, including whitespace. Unrecognized languages and blocks longer than 20,000 characters stay plain. Static rendering retains highlighting and omits copy controls; printing hides the code toolbar.
222
+
223
+ Images approved by the host's `urlPolicy` open in a modal viewer on click, Enter or Space. Use the close button, Escape or the backdrop to return to the original image. Linked images keep their link destination. See [host integration](local-integration-en.md) for the image allowlist.
224
+
219
225
  ### 3.4 Key differences from HTML
220
226
 
221
227
  | HTML habit | Reactive MD approach |
@@ -836,7 +842,7 @@ Notes:
836
842
  | `if` condition type error | `when="{{ seats }}"` yields a number | Change to `when="{{ seats >= 5 }}"` |
837
843
  | `on-click` is not part of the component | Attempting an event handler | Remove the event attribute and use component interactions |
838
844
  | HTML tags display as source or report structure errors | Unknown tag or missing end tag | Use Markdown or the matching component, and check closing |
839
- | Footnote displays as source with a warning | Footnote layout not yet supported | Turn it into prose notes for now |
845
+ | Footnote reference stays literal | No matching definition | Check the identifiers in `[^note]` and `[^note]: Note text` |
840
846
  | Chart shows a "20 USD" error | Text mixed into a numeric column | Write only the number and put the unit in the header |
841
847
  | `edge` points to a nonexistent node | Typo in the `to` id | Use consistent node ids |
842
848
  | Plot says integrals are unsupported | Formula outside the first version's computable scope | Use a supported function, or display it without plotting |
@@ -852,7 +858,7 @@ Notes:
852
858
 
853
859
  Diagnostics give the source location, severity, category and a short explanation; common categories include tag structure, unknown syntax, bindings, initial values, types, constraints, tables, diagrams and math problems.
854
860
 
855
- The Playground's left editor and right diagnostics panel locate problems together. Fallback warnings for unknown tags and footnotes preserve the source while other content and interactions keep working; controls inside unknown regions do not create bindings. Unclosed tags, invalid attributes on known components, expression or binding errors and resource limits still block compilation and disable interaction. Runtime local computation errors affect only the corresponding content, and other parts keep updating.
861
+ The Playground's left editor and right diagnostics panel locate problems together. Fallback warnings for unknown tags preserve the source while other content and interactions keep working; controls inside unknown regions do not create bindings. Unclosed component tags, invalid attributes on known components, expression or binding errors and resource limits still block compilation and disable interaction. Runtime local computation errors affect only the corresponding content, and other parts keep updating.
856
862
 
857
863
  When debugging, fix the first error. Later errors are sometimes only knock-on effects of the first one.
858
864
 
@@ -96,6 +96,12 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
96
96
 
97
97
  ### 3.4 代码、公式与转义
98
98
 
99
+ 正文中的 `Array<T>`、`Map<string, number>`、`x<y` 和货币 `$5`、`$10` 按文字处理;完整公式仍使用 `$...$` 或 `$$...$$`。单个未配对美元符号按文字显示。
100
+
101
+ 支持无属性的 `<b>...</b>`、`<i>...</i>`、`<u>...</u>`、`<s>...</s>`、`<mark>...</mark>` 和 `<br>` / `<br/>`,分别生成加粗、斜体、下划线、删除线、高亮和硬换行节点。它们属于正文格式,不是交互组件;普通单换行仍按 Markdown 软换行处理。
102
+
103
+ 脚注用 `[^note]` 引用,定义写为 `[^note]: 内容`,续写段落、列表和代码块按 Markdown 缩进。定义支持 Markdown 与上述基础 HTML。按首次引用顺序生成文末编号列表,重复引用共享编号并分别提供返回链接;标识符不区分大小写,重复定义采用第一条。未定义引用保留为文字,未引用定义不显示。脚注内的控件和插值保持为文字,不建立绑定或执行表达式。
104
+
99
105
  行内代码和代码围栏内的标签、插值、公式标记全部按原文显示。前导区中的源码修订指令是会被识别的版本注释;其他 Markdown 注释 `<!-- ... -->` 不产生组件或变量。
100
106
 
101
107
  正文用 `\{{` 显示字面量 `{{`,用 `\<slider>` 或行内代码显示标签示例。反斜杠的这类转义只属于 Markdown 上下文,不应用到 LaTeX 源码。
@@ -447,13 +453,12 @@ node.id 为当前图解内唯一的 `[A-Za-z_][A-Za-z0-9_-]*`。edge 必填 from
447
453
 
448
454
  ## 13. 诊断与验收规则
449
455
 
450
- 诊断包含严重程度、类别、简短解释、源码行列与修复建议。结构完整的未知标签区域按转义后的原始源码显示,给出 `local.component.unknown` 警告;脚注引用和定义保留原文,给出 `local.footnote.unsupported` 警告。这些区域内部的控件和插值不执行,其他正文与交互继续工作。无法可靠恢复的标签结构、已知组件的属性或表达式错误、绑定错误和资源预算问题仍阻止编译。运行时局部计算错误按第 5 节隔离。
456
+ 诊断包含严重程度、类别、简短解释、源码行列与修复建议。结构完整的未知标签区域按转义后的原始源码显示,给出 `local.component.unknown` 警告,内部控件和插值不执行。正常脚注不产生不支持警告。其他正文与交互继续工作。无法可靠恢复的组件标签结构、已知组件的属性或表达式错误、绑定错误和资源预算问题仍阻止编译。运行时局部计算错误按第 5 节隔离。
451
457
 
452
458
  | 类别 | 例子 | 应说明什么 |
453
459
  | --- | --- | --- |
454
460
  | 标签结构 | card 未闭合、错误嵌套 | 需要的结束标签及开始位置 |
455
461
  | 未知标签警告 | slidr | 未知名称、拼写建议以及局部源码降级 |
456
- | 脚注警告 | `[^note]` 和脚注定义 | 原文保留,尚未支持脚注排版 |
457
462
  | 非法语法 | on-click、actions 配置块 | 属性或旧语法不在当前模式 |
458
463
  | 绑定 | 引用 seats,但只声明 seat | 不存在的参数及候选名称 |
459
464
  | 初值 | 同名参数写两次 initial | 两处冲突位置 |
@@ -94,6 +94,12 @@ Unknown components, unknown attributes, wrong positions or wrong attribute types
94
94
 
95
95
  ### 3.4 Code, math and escaping
96
96
 
97
+ Prose such as `Array<T>`, `Map<string, number>`, `x<y` and currency `$5` or `$10` stays text. Complete formulas still use `$...$` or `$$...$$`; an unmatched single dollar sign stays literal.
98
+
99
+ Attribute-free `<b>...</b>`, `<i>...</i>`, `<u>...</u>`, `<s>...</s>`, `<mark>...</mark>` and `<br>` / `<br/>` produce bold, italic, underline, strikethrough, highlight and hard-break nodes. These are prose formatting, not interaction components. Ordinary single newlines remain Markdown soft breaks.
100
+
101
+ Reference a footnote with `[^note]` and define it with `[^note]: Note text`. Continuation paragraphs, lists and code blocks use Markdown indentation. Definitions support Markdown and the basic HTML above. Notes appear at the end in first-reference order; repeated references share a number and each has a return link. Identifiers are case-insensitive and the first duplicate definition wins. Undefined references stay literal; unused definitions stay hidden. Controls and interpolations inside notes remain text and create no bindings or executable expressions.
102
+
97
103
  Tags, interpolations and formula markers inside inline code and code fences are displayed verbatim. The source revision directive in the prologue is the recognized version comment; other Markdown comments `<!-- ... -->` produce no components or variables.
98
104
 
99
105
  Use `\{{` in prose to display a literal `{{`, and `\<slider>` or inline code to show a tag example. These backslash escapes belong only to the Markdown context and do not apply to LaTeX sources.
@@ -445,13 +451,12 @@ This draft does not accept legacy tags such as form, submit, button, each, list,
445
451
 
446
452
  ## 13. Diagnostics and acceptance rules
447
453
 
448
- Diagnostics include severity, category, a short explanation, source line/column and a fix suggestion. A structurally complete unknown tag region is displayed from escaped original source with a `local.component.unknown` warning; footnote references and definitions keep their source with a `local.footnote.unsupported` warning. Controls and interpolations inside these regions are not executed, while other prose and interactions keep working. Tag structures that cannot be reliably recovered, attribute or expression errors on known components, binding errors and resource budget problems still block compilation. Runtime local computation errors are isolated as described in section 5.
454
+ Diagnostics include severity, category, a short explanation, source line/column and a fix suggestion. A structurally complete unknown tag region is displayed from escaped original source with a `local.component.unknown` warning; its controls and interpolations are not executed. Normal footnotes produce no unsupported-syntax warning. Other prose and interactions keep working. Component tag structures that cannot be reliably recovered, attribute or expression errors on known components, binding errors and resource budget problems still block compilation. Runtime local computation errors are isolated as described in section 5.
449
455
 
450
456
  | Category | Example | What it should explain |
451
457
  | --- | --- | --- |
452
458
  | Tag structure | card unclosed, wrong nesting | The required end tag and start position |
453
459
  | Unknown tag warning | slidr | Unknown name, spelling suggestion and local source fallback |
454
- | Footnote warning | `[^note]` and footnote definition | Source preserved; footnote layout not yet supported |
455
460
  | Invalid syntax | on-click, actions configuration block | Attribute or legacy syntax not in the current mode |
456
461
  | Binding | references seats but only seat is declared | The missing parameter and candidate names |
457
462
  | Initial value | initial written twice for a same-name parameter | Both conflict positions |
@@ -1,23 +1,23 @@
1
- # 0.4.1 发布说明
2
-
3
- `reactive-md@0.4.1` 是兼容 0.4.0 的补丁版。语法仍为 `local-draft-2`,组块协议为 `component-protocol-1`,主题协议为 `reactive-md-theme-1`;现有 0.4.0 文档无需迁移。
4
-
5
- ```sh
6
- npm install reactive-md@0.4.1
7
- ```
8
-
9
- 本版本发布于 `latest` 和 `next`。离线安装可下载 [npm 安装包](https://registry.npmjs.org/reactive-md/-/reactive-md-0.4.1.tgz)。
10
-
11
- ## 变化
12
-
13
- 文档采用更柔和的底色、较少的边框、低饱和图表配色和更平滑的控件动效。输入框和按钮使用气泡圆角;滑块轨道采用统一样式,并支持 `color` 设置背景色。表格占满容器并均衡分配列宽,用三角形表示排序方向;环形图更充分地利用可用空间。
14
-
15
- LaTeX 使用正文字号和黑白文字颜色,分段函数的表达式与条件保持分离。坐标控件增加网格、箭头轴、虚线投影和可拖动的坐标标注点。quiz 输入框占满可用宽度,题目和操作区整体垂直居中。Playground 在工具栏插入后保留编辑器滚动位置,日期输入框适应窄屏。
16
-
17
- 本次更新调整外观和交互,编译器、运行时与状态文件契约保持不变。使用自定义样式的宿主应检查新的默认外观。完整变化见[变更记录](../CHANGELOG-ch.md);从较早 minor 版本升级时,参阅[0.4.0 迁移指南](release-0.4.0-ch.md)。
18
-
19
- ## 验证与限制
20
-
21
- 发布检查覆盖核心与 Demo 测试、类型、包入口、文档链接、离线安装包消费、静态 SSR、独立 HTML 和浏览器交互。CI 目标为 Node 22.12、24 与 Chromium;本地浏览器检查使用 Windows 上的 Microsoft Edge。导出 HTML 以外的通用 SSR 水合、Firefox 和 WebKit 尚未验证。
22
-
23
- 项目仍处于 0.x 预览阶段。安全边界和宿主职责见 [SECURITY-ch.md](../SECURITY-ch.md)。
1
+ # 0.4.1 发布说明
2
+
3
+ `reactive-md@0.4.1` 是兼容 0.4.0 的补丁版。语法仍为 `local-draft-2`,组块协议为 `component-protocol-1`,主题协议为 `reactive-md-theme-1`;现有 0.4.0 文档无需迁移。
4
+
5
+ ```sh
6
+ npm install reactive-md@0.4.1
7
+ ```
8
+
9
+ 本版本发布于 `latest` 和 `next`。离线安装可下载 [npm 安装包](https://registry.npmjs.org/reactive-md/-/reactive-md-0.4.1.tgz)。
10
+
11
+ ## 变化
12
+
13
+ 文档采用更柔和的底色、较少的边框、低饱和图表配色和更平滑的控件动效。输入框和按钮使用气泡圆角;滑块轨道采用统一样式,并支持 `color` 设置背景色。表格占满容器并均衡分配列宽,用三角形表示排序方向;环形图更充分地利用可用空间。
14
+
15
+ LaTeX 使用正文字号和黑白文字颜色,分段函数的表达式与条件保持分离。坐标控件增加网格、箭头轴、虚线投影和可拖动的坐标标注点。quiz 输入框占满可用宽度,题目和操作区整体垂直居中。Playground 在工具栏插入后保留编辑器滚动位置,日期输入框适应窄屏。
16
+
17
+ 本次更新调整外观和交互,编译器、运行时与状态文件契约保持不变。使用自定义样式的宿主应检查新的默认外观。完整变化见[变更记录](../CHANGELOG-ch.md);从较早 minor 版本升级时,参阅[0.4.0 迁移指南](release-0.4.0-ch.md)。
18
+
19
+ ## 验证与限制
20
+
21
+ 发布检查覆盖核心与 Demo 测试、类型、包入口、文档链接、离线安装包消费、静态 SSR、独立 HTML 和浏览器交互。CI 目标为 Node 22.12、24 与 Chromium;本地浏览器检查使用 Windows 上的 Microsoft Edge。导出 HTML 以外的通用 SSR 水合、Firefox 和 WebKit 尚未验证。
22
+
23
+ 项目仍处于 0.x 预览阶段。安全边界和宿主职责见 [SECURITY-ch.md](../SECURITY-ch.md)。
@@ -1,23 +1,23 @@
1
- # 0.4.1 release notes
2
-
3
- `reactive-md@0.4.1` is a compatible patch for 0.4.0. It keeps `local-draft-2`, `component-protocol-1` and `reactive-md-theme-1`; existing 0.4.0 documents need no migration.
4
-
5
- ```sh
6
- npm install reactive-md@0.4.1
7
- ```
8
-
9
- The release is available on `latest` and `next`. For offline installation, use the [npm tarball](https://registry.npmjs.org/reactive-md/-/reactive-md-0.4.1.tgz).
10
-
11
- ## Changes
12
-
13
- Documents use quieter surfaces, fewer borders, muted chart colors and smoother control transitions. Fields and buttons have rounded ends; sliders have custom tracks that honor their `color` attribute. Tables fill their container with balanced columns and triangle sort indicators. Donut charts use more of the available space.
14
-
15
- LaTeX uses the body font size and black/white ink, and piecewise expressions keep their conditions separate. Coordinate controls gain a grid, arrow axes, dashed projections and a labeled draggable point. Quiz inputs fill the container and the question and actions are vertically centered. The Playground preserves editor scroll after toolbar insertion and fits date inputs on narrow screens.
16
-
17
- These are visual and interaction changes; the compiler, runtime and state-file contracts remain unchanged. Hosts with custom styles should review the revised defaults. See the [changelog](../CHANGELOG.md) and the [0.4.0 migration guide](release-0.4.0-en.md) when upgrading from an earlier minor release.
18
-
19
- ## Validation and limits
20
-
21
- Release verification covers core and demo tests, types, package exports, documentation links, offline tarball consumers, static SSR, standalone HTML and browser interactions. CI targets Node 22.12 and 24 with Chromium; local browser checks use Microsoft Edge on Windows. General SSR hydration outside exported HTML, Firefox and WebKit remain unverified.
22
-
23
- The project remains a 0.x preview. Security boundaries and host responsibilities are documented in [SECURITY.md](../SECURITY.md).
1
+ # 0.4.1 release notes
2
+
3
+ `reactive-md@0.4.1` is a compatible patch for 0.4.0. It keeps `local-draft-2`, `component-protocol-1` and `reactive-md-theme-1`; existing 0.4.0 documents need no migration.
4
+
5
+ ```sh
6
+ npm install reactive-md@0.4.1
7
+ ```
8
+
9
+ The release is available on `latest` and `next`. For offline installation, use the [npm tarball](https://registry.npmjs.org/reactive-md/-/reactive-md-0.4.1.tgz).
10
+
11
+ ## Changes
12
+
13
+ Documents use quieter surfaces, fewer borders, muted chart colors and smoother control transitions. Fields and buttons have rounded ends; sliders have custom tracks that honor their `color` attribute. Tables fill their container with balanced columns and triangle sort indicators. Donut charts use more of the available space.
14
+
15
+ LaTeX uses the body font size and black/white ink, and piecewise expressions keep their conditions separate. Coordinate controls gain a grid, arrow axes, dashed projections and a labeled draggable point. Quiz inputs fill the container and the question and actions are vertically centered. The Playground preserves editor scroll after toolbar insertion and fits date inputs on narrow screens.
16
+
17
+ These are visual and interaction changes; the compiler, runtime and state-file contracts remain unchanged. Hosts with custom styles should review the revised defaults. See the [changelog](../CHANGELOG.md) and the [0.4.0 migration guide](release-0.4.0-en.md) when upgrading from an earlier minor release.
18
+
19
+ ## Validation and limits
20
+
21
+ Release verification covers core and demo tests, types, package exports, documentation links, offline tarball consumers, static SSR, standalone HTML and browser interactions. CI targets Node 22.12 and 24 with Chromium; local browser checks use Microsoft Edge on Windows. General SSR hydration outside exported HTML, Firefox and WebKit remain unverified.
22
+
23
+ The project remains a 0.x preview. Security boundaries and host responsibilities are documented in [SECURITY.md](../SECURITY.md).
@@ -0,0 +1,41 @@
1
+ # 0.5.0 预览版发布说明
2
+
3
+ `reactive-md@0.5.0` 是目标渠道为 `next` 的 0.x 预览版。语法修订仍为 `local-draft-2`,组块协议为 `component-protocol-1`,主题协议为 `reactive-md-theme-1`。现有 0.4.x 导入和文档无需迁移,`latest` 仍为 `0.4.0`。
4
+
5
+ ```sh
6
+ npm install reactive-md@next
7
+ # 或固定预览版
8
+ npm install reactive-md@0.5.0
9
+ ```
10
+
11
+ 离线安装可下载 [npm 安装包](https://registry.npmjs.org/reactive-md/-/reactive-md-0.5.0.tgz)。
12
+
13
+ ## 编辑器入口
14
+
15
+ `0.5.0` 新增 `reactive-md/editor`,这是从 Playground 抽出的受控 React 19 源码编辑器。它提供源码高亮、Markdown 格式化、组块插入模板、补全、绑定导航、重命名、格式化、撤销重做、行号和滚动同步。语言与主题按实例配置。
16
+
17
+ 编辑器使用独立样式表 `reactive-md/editor/styles.css`,规则限定在编辑器根节点,因此可以在不加载文档渲染样式时使用。需要显示预览的宿主仍按原有方式引入 `reactive-md/styles.css`。
18
+
19
+ `ReactiveMarkdownEditor` 接收 `value` 和 `onChange`,并通过 ref 句柄提供聚焦、选区、textarea 访问、撤销和重做。可选的 `diagnostics` 和 `document` 属性增加行号标记与绑定值类型。作者工具在本地分析源码;宿主通过 `onExport` 接入工具栏导出操作,并自行连接预览与存储。完整属性表、历史规则、只读模式和服务端渲染说明见 [React 源码编辑器](editor-ch.md)。
20
+
21
+ ## 文档渲染
22
+
23
+ 泛型、比较式和货币现在按普通正文保留,不再被识别为组件标签或公式。支持无属性的 `<b>`、`<i>`、`<u>`、`<s>`、`<mark>` 和 `<br>` 基础格式。Markdown 脚注按正文排版,包含编号、重复引用及返回链接。
24
+
25
+ 这些新增能力扩展正文解析与文档渲染。语法修订、组块协议和主题协议保持不变。
26
+
27
+ 代码围栏支持 JavaScript、TypeScript、Python、JSON、Bash、HTML、CSS 等常见语言高亮。复制按钮保留原文,并显示成功或失败反馈。未知语言及超过 20,000 字符的代码块按纯文本显示。静态输出保留高亮;静态输出与打印不显示复制控件。
28
+
29
+ 通过宿主 URL 策略的图片可以点击放大,也可用 Enter 或空格打开;关闭按钮、Esc 和遮罩都能关闭预览,并恢复原图焦点。带链接的图片保留链接导航,静态输出保留普通图片。用法见[作者指南](local-guide-ch.md)与[图片策略](local-integration-ch.md#图片与链接策略)。
30
+
31
+ ## 兼容性
32
+
33
+ 现有 `reactive-md`、`reactive-md/react` 和 `reactive-md/styles.css` 导入继续有效,渲染器入口未变。为 `0.4.x` 编写的文档无需修改。本版本新增公开入口;只渲染文档的项目可以直接升级。
34
+
35
+ 编辑器需要 React 19,核心 `reactive-md` 入口仍不依赖 React。版本轴与迁移规则见[变更记录](../CHANGELOG-ch.md)和[版本与兼容性](compatibility-ch.md)。
36
+
37
+ ## 验证与限制
38
+
39
+ 0.5.0 发布门禁覆盖核心与渲染器测试、编辑器入口、类型检查、包入口、文档链接、离线安装包消费、静态渲染和浏览器交互。CI 目标为 Node 22.12、24 与 Chromium;本地浏览器检查使用 Windows 上的 Microsoft Edge。导出 HTML 以外的通用 SSR 水合、Firefox 和 WebKit 尚未验证。
40
+
41
+ 项目仍处于 0.x 预览阶段。安全边界和宿主职责见 [SECURITY-ch.md](../SECURITY-ch.md)。
@@ -0,0 +1,41 @@
1
+ # 0.5.0 preview release
2
+
3
+ `reactive-md@0.5.0` is a 0.x preview that targets the `next` channel. It keeps syntax revision `local-draft-2`, component protocol `component-protocol-1` and theme protocol `reactive-md-theme-1`. Existing 0.4.x imports and documents need no migration. `latest` remains `0.4.0`.
4
+
5
+ ```sh
6
+ npm install reactive-md@next
7
+ # or pin the preview
8
+ npm install reactive-md@0.5.0
9
+ ```
10
+
11
+ For offline installation, use the [npm tarball](https://registry.npmjs.org/reactive-md/-/reactive-md-0.5.0.tgz).
12
+
13
+ ## Editor entry
14
+
15
+ `0.5.0` adds `reactive-md/editor`, a controlled React 19 source editor extracted from the Playground. It handles source highlighting, Markdown formatting, component insertion templates, completion, binding navigation, rename, format, undo and redo, line numbers and scroll synchronization. Locale and theme are configured per instance.
16
+
17
+ The editor has an independent stylesheet at `reactive-md/editor/styles.css`. Its rules are scoped to the editor root, so it can be loaded without the document renderer styles. A host that shows a preview imports `reactive-md/styles.css` as before.
18
+
19
+ `ReactiveMarkdownEditor` takes `value` and `onChange` and exposes a ref handle for focus, selection, textarea access, undo and redo. Optional `diagnostics` and `document` props add gutter markers and binding value types. Authoring tools analyze source locally; the host manages preview, storage and the toolbar export action through `onExport`. See [React source editor](editor-en.md) for the full prop table, history rules, read-only modes and server rendering notes.
20
+
21
+ ## Document rendering
22
+
23
+ Documents now preserve ordinary generic or comparison text and currency instead of reading it as a component tag or formula. Attribute-free `<b>`, `<i>`, `<u>`, `<s>`, `<mark>` and `<br>` are supported as basic HTML formatting. Markdown footnotes render with rich definitions, numbering, repeated references and return links.
24
+
25
+ These additions extend prose parsing and document rendering. The syntax revision, component protocol and theme protocol keep their current versions.
26
+
27
+ Fenced code blocks highlight common languages, including JavaScript, TypeScript, Python, JSON, Bash, HTML and CSS. A copy button copies the original text with success or failure feedback. Unknown languages and blocks longer than 20,000 characters remain plain text. Static output keeps highlighting; copy controls are omitted from static output and printing.
28
+
29
+ Images approved by the host URL policy open in a modal viewer. Enter or Space opens the image; the close button, Escape or the backdrop dismisses it and restores focus. Linked images keep their link navigation. Static output keeps ordinary images. See the [author guide](local-guide-en.md) and [host integration](local-integration-en.md) for usage.
30
+
31
+ ## Compatibility
32
+
33
+ Existing `reactive-md`, `reactive-md/react` and `reactive-md/styles.css` imports keep working, and the renderer entry is unchanged. Documents written for `0.4.x` need no edit. The release adds a public entry; projects that only render documents can upgrade without changes.
34
+
35
+ The editor requires React 19. The core `reactive-md` entry still does not depend on React. See the [changelog](../CHANGELOG.md) and [Versions and compatibility](compatibility-en.md) for the version axes.
36
+
37
+ ## Validation and limits
38
+
39
+ The 0.5.0 release gate covers core and renderer tests, the editor entry, type checking, package exports, documentation links, offline tarball consumers, static rendering and browser interaction. CI targets Node 22.12 and 24 with Chromium; local browser checks use Microsoft Edge. General SSR hydration outside exported HTML, Firefox and WebKit remain unverified.
40
+
41
+ The project remains a 0.x preview. Security boundaries and host responsibilities are documented in [SECURITY.md](../SECURITY.md).
@@ -1,101 +1,108 @@
1
- # 发布清单
2
-
3
- 本文件是维护者的手动发布流程。本清单覆盖 `0.4.1` 预览版,目前 `latest` 和 `next` 均指向该版本。版本规则见[版本与兼容性](compatibility-ch.md),面向使用者的升级说明见[0.4.1 发布说明](release-0.4.1-ch.md)。
4
-
5
- ## 发布前确认
6
-
7
- ### 包身份与元数据
8
-
9
- 非 scope 名称 `reactive-md` 已由已发布的 `0.3.0`、`0.3.1` 建立,`reactive-md/react` 和 `reactive-md/styles.css` 子路径也随这些版本生效。不要把改名当作常规发布准备:改名会破坏导入、状态工具和文档。
10
-
11
- 1. 除非维护者明确决定改用 scope,否则保持 `reactive-md`。scope 需要对应的 npm 账号或组织权限。
12
- 2. 如果改名,同时更新 `package.json` 的 `name`、文档中的导入语句、tarball 文件名说明、示例和两个子路径,并在变更记录中按破坏性变更说明。
13
- 3. 核对 `package.json` 的 `repository`、`homepage`、`bugs`、`license`、`engines` 等发布元数据;当前已设置,发布前确认 URL 和最低 Node 版本仍然正确,并确认 `private` 保持移除状态。
14
- 4. 确认 `files` 覆盖发布所需内容。当前包含 `dist-library`、`dist-standalone`、`bin`、`cli`、README(`README.md`、`README-en.md`、`README-ch.md`)、中英文贡献指南、变更记录与安全策略、`THIRD_PARTY_NOTICES.md`、`docs` 和 `examples`;新增文档或 notice 时同步加入 `files`。
15
-
16
- 包名和版本决定 tarball 名称。当前 `0.4.1` 的预期文件名是 `reactive-md-0.4.1.tgz`;改名或改版本后以 `npm pack` 的实际输出为准。
17
-
18
- ### 第三方 notice
19
-
20
- 库产物打包了 `remark-gfm@4.0.1`、`remark-parse@11.0.0`、`unified@11.0.5` 及其依赖。独立 HTML 运行时还打包了 React、React DOM 和 scheduler;库的 React 入口使用宿主提供的 peer dependency。`THIRD_PARTY_NOTICES.md` 保留这些打包依赖的版权和许可声明。
21
-
22
- 维护者在发布前:
23
-
24
- 1. 运行 `npm run notices`,从已安装依赖重新生成 `THIRD_PARTY_NOTICES.md`。生成脚本覆盖 `remark-gfm`、`remark-parse`、`unified`、`react`、`react-dom` 的依赖树和实际许可证文本,包括 scheduler。
25
- 2. 确认 `package.json` 的 `files` 包含 `THIRD_PARTY_NOTICES.md`,并随 tarball 分发。
26
- 3. 检查 `npm pack --dry-run` 的输出,确认没有 `node_modules`、`demo/`、`demo/artifacts/`、测试产物或本地缓存。
27
- 4. 核对依赖许可证与打包内容一致;新增或升级 Markdown 依赖后重新生成 notice。
28
-
29
- ## 本地 tarball 安装
30
-
31
- 完整的本地门禁是:
32
-
33
- ```sh
34
- npm ci
35
- npm run verify:release
36
- ```
37
-
38
- `verify:release` 运行 Node 端与浏览器检查,构建包,在仓库外安装真实 tarball,并验证多份能力组合后的文档行为;它自行管理预览服务和浏览器生命周期。CI 通过 `verify:release:node` 和 `verify:release:browser` 分片运行同一门禁。本机需已安装浏览器。
39
-
40
- packed 检查会在 `artifacts/release-package/` 保留经过验证的原始安装包,并在同目录的 `package-verification.json` 记录 SHA256 与 npm integrity。完整门禁通过后发布这一安装包;源码、包元数据或随包文档变化后重新验证。
41
-
42
- 需要手工检查包内容时,直接使用 tarball。在仓库根目录:
43
-
44
- ```sh
45
- npm pack
46
- ```
47
-
48
- `npm pack` 会通过 `prepack` 先运行构建和 `npm run notices`,生成 `dist-library/` 与 `THIRD_PARTY_NOTICES.md`。`dist-library/` 是 `package.json` 的 `exports` 指向的目录。随后在一个空目录中验证安装:
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.4.1.tgz
55
- ```
56
-
57
- 核心入口可在 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
- React 入口需要另装 React 19:
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
- 静态 SSR 渲染由 packed 检查覆盖。单文件导出的静态首屏水合由 Playwright Chromium 和本地 Edge 浏览器检查覆盖;该路径之外的通用 SSR 水合尚未验证。安装验证还应确认 tarball 中的 `dist-library/types`、`dist-standalone`、`bin`、`cli`、`README.md`、`README-en.md`、`README-ch.md`、`CHANGELOG-ch.md`、`SECURITY-ch.md`、`THIRD_PARTY_NOTICES.md`、`docs` 和 `examples` 完整,并检查 `docs` 中没有指向未打包 `demo/`、`src/`、`tests/` 或 `.tasks/` 文件的本地链接。
75
-
76
- ## 发布说明
77
-
78
- 发布说明面向使用者,至少包含:
79
-
80
- - 包版本、`LOCAL_SYNTAX_VERSION`、组块协议修订与主题协议修订;这些不是同一个版本号。
81
- - 安装方式:`npm install reactive-md@next`,或使用 `npm install reactive-md@<version>` 固定版本;并提供可下载 tarball 作为离线安装选项。
82
- - 用户可见变化、破坏性变更和迁移步骤;直接链接[变更记录](../CHANGELOG-ch.md),本轮同时链接[0.4.1 发布说明](release-0.4.1-ch.md)。
83
- - 已验证的平台,以及未验证的浏览器、通用 SSR 水合等范围。
84
- - 已知限制和安全说明链接 [SECURITY-ch.md](../SECURITY-ch.md)。
85
-
86
- 不要写尚未执行的检查结果,也不要把 CI 配置存在写成 CI 已通过。
87
-
88
- ## 人工发布清单
89
-
90
- 1. 确认工作区干净,变更已审查;`npm ci` 从锁文件安装成功。
91
- 2. 在 Node 22.12 和受支持的较新 LTS(当前为 24)上运行 `npm run verify:release`。这是维护者和 CI 共用的完整门禁,不要用一组自行挑选的命令代替。
92
- 3. 确认版本号、`CHANGELOG-ch.md` 和发布说明一致。语法变化时更新 `LOCAL_SYNTAX_VERSION`;组块或主题协议修订仅在各自契约变化时更新,这些版本轴保持独立。
93
- 4. 检查门禁保留的安装包,包括文件列表、大小和许可文件。手动重新运行 `npm pack` 会产生新候选包,需要单独完成安装验证。
94
- 5. 核对安装包的 SHA256 与 `artifacts/release-package/package-verification.json` 一致,并记录到发布说明或内部发布记录。
95
- 6. 合并发布提交,等待 `main` 上的 CI 全部通过。
96
- 7. 手动创建并推送 tag,例如 `v0.4.1`。不要在自动发布工作流中保存 npm token。
97
- 8. 在维护者本机完成 npm 登录和双因素认证后,手动发布已经验证的预览版安装包:`npm publish artifacts/release-package/reactive-md-0.4.1.tgz --access public --tag next`。预览版先发布到 `next`。维护者决定提升后,使用 `npm dist-tag add reactive-md@<version> latest` 更新默认版本。当前 `latest` 的兼容补丁版在发布验证后,同步更新这两个渠道。
98
- 9. 在 npm 和 GitHub Releases 上核对包内容、版本、README、许可与发布说明;从公开 registry 重新安装一次。
99
- 10. 从 registry 验证 README 中的安装命令可用,核对 registry 的完整性摘要与发布 tarball 一致。
100
-
101
- README 中的版本与安装命令应在打包前准备好,并在发布后验证。发布过程中不要提交 token、`.npmrc` 凭据或本机路径。
1
+ # 发布清单
2
+
3
+ 本文件是维护者的手动发布流程。本清单覆盖 `0.5.0` 预览版,目标渠道为 `next`,`latest` 仍为 `0.4.0`。版本规则见[版本与兼容性](compatibility-ch.md),面向使用者的说明见[0.5.0 发布说明](release-0.5.0-ch.md)。
4
+
5
+ ## 发布前确认
6
+
7
+ ### 包身份与元数据
8
+
9
+ 非 scope 名称 `reactive-md` 已由已发布的 `0.3.0`、`0.3.1` 建立,`reactive-md/react` 和 `reactive-md/styles.css` 子路径也随这些版本生效。`0.5.0` 新增 `reactive-md/editor` 和 `reactive-md/editor/styles.css`。不要把改名当作常规发布准备:改名会破坏导入、状态工具和文档。
10
+
11
+ 1. 除非维护者明确决定改用 scope,否则保持 `reactive-md`。scope 需要对应的 npm 账号或组织权限。
12
+ 2. 如果改名,同时更新 `package.json` 的 `name`、文档中的导入语句、tarball 文件名说明、示例和相关子路径,并在变更记录中按破坏性变更说明。
13
+ 3. 核对 `package.json` 的 `repository`、`homepage`、`bugs`、`license`、`engines` 等发布元数据;当前已设置,发布前确认 URL 和最低 Node 版本仍然正确,并确认 `private` 保持移除状态。
14
+ 4. 确认 `files` 覆盖发布所需内容。当前包含 `dist-library`、`dist-standalone`、`bin`、`cli`、README(`README.md`、`README-en.md`、`README-ch.md`)、中英文贡献指南、变更记录与安全策略、`THIRD_PARTY_NOTICES.md`、`docs` 和 `examples`;新增文档或 notice 时同步加入 `files`。
15
+
16
+ 包名和版本决定 tarball 名称。当前 `0.5.0` 的预期文件名是 `reactive-md-0.5.0.tgz`;改名或改版本后以 `npm pack` 的实际输出为准。
17
+
18
+ ### 第三方 notice
19
+
20
+ 库产物打包了 `remark-gfm@4.0.1`、`remark-parse@11.0.0`、`unified@11.0.5` 及其依赖。独立 HTML 运行时还打包了 React、React DOM 和 scheduler;库的 React 入口使用宿主提供的 peer dependency。`THIRD_PARTY_NOTICES.md` 保留这些打包依赖的版权和许可声明。
21
+
22
+ 维护者在发布前:
23
+
24
+ 1. 运行 `npm run notices`,从已安装依赖重新生成 `THIRD_PARTY_NOTICES.md`。生成脚本覆盖 `remark-gfm`、`remark-parse`、`unified`、`react`、`react-dom` 的依赖树和实际许可证文本,包括 scheduler。
25
+ 2. 确认 `package.json` 的 `files` 包含 `THIRD_PARTY_NOTICES.md`,并随 tarball 分发。
26
+ 3. 检查 `npm pack --dry-run` 的输出,确认没有 `node_modules`、`demo/`、`demo/artifacts/`、测试产物或本地缓存。
27
+ 4. 核对依赖许可证与打包内容一致;新增或升级 Markdown 依赖后重新生成 notice。
28
+
29
+ ## 本地 tarball 安装
30
+
31
+ 完整的本地门禁是:
32
+
33
+ ```sh
34
+ npm ci
35
+ npm run verify:release
36
+ ```
37
+
38
+ `verify:release` 运行 Node 端与浏览器检查,构建包,在仓库外安装真实 tarball,并验证多份能力组合后的文档行为;它自行管理预览服务和浏览器生命周期。门禁同时覆盖编辑器入口、其样式表及同一页面的两个编辑器实例。CI 通过 `verify:release:node` 和 `verify:release:browser` 分片运行同一门禁。本机需已安装浏览器。
39
+
40
+ packed 检查会在 `artifacts/release-package/` 保留经过验证的原始安装包,并在同目录的 `package-verification.json` 记录 SHA256 与 npm integrity。完整门禁通过后发布这一安装包;源码、包元数据或随包文档变化后重新验证。
41
+
42
+ 需要手工检查包内容时,直接使用 tarball。在仓库根目录:
43
+
44
+ ```sh
45
+ npm pack
46
+ ```
47
+
48
+ `npm pack` 会通过 `prepack` 先运行构建和 `npm run notices`,生成 `dist-library/` 与 `THIRD_PARTY_NOTICES.md`。`dist-library/` 是 `package.json` 的 `exports` 指向的目录。随后在一个空目录中验证安装:
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
+ 核心入口可在 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
+ React 入口需要另装 React 19:
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
+ 编辑器入口使用相同的 React peer 和独立样式表:
75
+
76
+ ```tsx
77
+ import { ReactiveMarkdownEditor } from 'reactive-md/editor';
78
+ import 'reactive-md/editor/styles.css';
79
+ ```
80
+
81
+ 静态 SSR 渲染由 packed 检查覆盖。编辑器入口在服务端渲染检查中导入,并在浏览器检查中运行。单文件导出的静态首屏水合由 Playwright Chromium 和本地 Edge 浏览器检查覆盖;该路径之外的通用 SSR 水合尚未验证。安装验证还应确认 tarball 中的 `dist-library/types`(包括编辑器入口和样式表)、`dist-standalone`、`bin`、`cli`、`README.md`、`README-en.md`、`README-ch.md`、`CHANGELOG-ch.md`、`SECURITY-ch.md`、`THIRD_PARTY_NOTICES.md`、`docs` 和 `examples` 完整,并检查 `docs` 中没有指向未打包 `demo/`、`src/`、`tests/` 或 `.tasks/` 文件的本地链接。
82
+
83
+ ## 发布说明
84
+
85
+ 发布说明面向使用者,至少包含:
86
+
87
+ - 包版本、`LOCAL_SYNTAX_VERSION`、组块协议修订与主题协议修订;这些不是同一个版本号。
88
+ - 安装方式:`npm install reactive-md@next`,或使用 `npm install reactive-md@<version>` 固定版本;并提供可下载 tarball 作为离线安装选项。
89
+ - 用户可见变化、破坏性变更和迁移步骤;直接链接[变更记录](../CHANGELOG-ch.md),本轮同时链接[0.5.0 发布说明](release-0.5.0-ch.md)。
90
+ - 已验证的平台,以及未验证的浏览器、通用 SSR 水合等范围。
91
+ - 已知限制和安全说明链接 [SECURITY-ch.md](../SECURITY-ch.md)。
92
+
93
+ 不要写尚未执行的检查结果,也不要把 CI 配置存在写成 CI 已通过。
94
+
95
+ ## 人工发布清单
96
+
97
+ 1. 确认工作区干净,变更已审查;`npm ci` 从锁文件安装成功。
98
+ 2. 在 Node 22.12 和受支持的较新 LTS(当前为 24)上运行 `npm run verify:release`。这是维护者和 CI 共用的完整门禁,不要用一组自行挑选的命令代替。
99
+ 3. 确认版本号、`CHANGELOG-ch.md` 和发布说明一致。`0.5.0` 新增编辑器入口,但 `LOCAL_SYNTAX_VERSION`、组块协议和主题协议修订不变。仅在某条版本轴自身的契约变化时更新它。
100
+ 4. 检查门禁保留的安装包,包括文件列表、大小和许可文件。手动重新运行 `npm pack` 会产生新候选包,需要单独完成安装验证。
101
+ 5. 核对安装包的 SHA256 与 `artifacts/release-package/package-verification.json` 一致,并记录到发布说明或内部发布记录。
102
+ 6. 合并发布提交,等待 `main` 上的 CI 全部通过。
103
+ 7. 手动创建并推送 tag,例如 `v0.5.0`。不要在自动发布工作流中保存 npm token。
104
+ 8. 在维护者本机完成 npm 登录和双因素认证后,手动发布已经验证的预览版安装包:`npm publish artifacts/release-package/reactive-md-0.5.0.tgz --access public --tag next`。预览版先发布到 `next`,本次 `latest` 保持 `0.4.0`。提升 `0.5.0` 需要单独决定:`npm dist-tag add reactive-md@0.5.0 latest`。
105
+ 9. 在 npm 和 GitHub Releases 上核对包内容、版本、README、许可与发布说明;从公开 registry 重新安装一次。
106
+ 10. 从 registry 验证 README 中的安装命令可用,核对 registry 的完整性摘要与发布 tarball 一致。
107
+
108
+ README 中的版本与安装命令应在打包前准备好,并在发布后验证。发布过程中不要提交 token、`.npmrc` 凭据或本机路径。