reactive-md 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +144 -113
- package/CHANGELOG.md +144 -113
- package/LICENSE +21 -21
- package/README-ch.md +154 -123
- package/README-en.md +179 -147
- package/README.md +179 -147
- package/SECURITY-ch.md +4 -3
- package/SECURITY.md +4 -3
- package/THIRD_PARTY_NOTICES.md +138 -1
- package/bin/reactive-md.mjs +1 -1
- package/dist-library/reactive-md-editor.css +2 -0
- package/dist-library/reactive-md-editor.js +3834 -0
- package/dist-library/reactive-md-react.js +9324 -1670
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +426 -305
- package/dist-library/{runtime-D3QTVYaz.js → runtime-CXBdLQ3A.js} +8950 -2895
- 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 +109 -0
- package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
- package/dist-library/types/editor/editor-view-bar.d.ts +11 -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 +51 -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/LocalDocumentView.d.ts +10 -3
- package/dist-library/types/local/code-block.d.ts +26 -0
- package/dist-library/types/local/diagnostics.d.ts +25 -0
- package/dist-library/types/local/footnotes.d.ts +51 -0
- package/dist-library/types/local/heading-anchors.d.ts +2 -0
- package/dist-library/types/local/html.d.ts +16 -0
- package/dist-library/types/local/image-view.d.ts +23 -0
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/options.d.ts +29 -0
- package/dist-library/types/local/types.d.ts +42 -1
- package/dist-library/types/local/worker.d.ts +18 -6
- package/dist-library/types/shareable.d.ts +9 -1
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +49 -38
- 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 +235 -0
- package/docs/editor-en.md +235 -0
- package/docs/html-compatibility-ch.md +98 -0
- package/docs/html-compatibility-en.md +98 -0
- package/docs/local-guide-ch.md +11 -5
- package/docs/local-guide-en.md +11 -5
- package/docs/local-integration-ch.md +4 -1
- package/docs/local-integration-en.md +4 -1
- package/docs/local-interaction-syntax-ch.md +9 -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/release-0.5.1-ch.md +39 -0
- package/docs/release-0.5.1-en.md +39 -0
- package/docs/releasing-ch.md +108 -101
- package/docs/releasing-en.md +108 -101
- package/docs/shareable-export-ch.md +6 -2
- package/docs/shareable-export-en.md +6 -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/README.md +2 -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/html-compat.reactive.md +24 -0
- 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 +135 -91
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# HTML 部分兼容与暂时性分流政策
|
|
2
|
+
|
|
3
|
+
此功能面向下个发行版。默认文档继续使用 Markdown、ReactiveMD 控件和表达式,并支持下表中的 P0 HTML。CSS、JavaScript 和扩展 HTML 由宿主分别开启,默认全部关闭。
|
|
4
|
+
|
|
5
|
+
## 暂时性分流政策
|
|
6
|
+
|
|
7
|
+
为了避开作者 CSS、JavaScript、扩展 HTML 与 ReactiveMD 之间的混合解析和渲染冲突,本版采用整篇分流:
|
|
8
|
+
|
|
9
|
+
| 编译选项 | 文档行为 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| 三个开关全部关闭或省略 | 使用 ReactiveMD 解析器和现有 React 渲染器,支持 P0 HTML |
|
|
12
|
+
| 任意一个开关为 `true` | 整篇源码按原生 HTML 处理,在隔离的 iframe 中渲染 |
|
|
13
|
+
|
|
14
|
+
原生 HTML 路径中的 `# 标题`、`**强调**`、LaTeX 和 `{{ 表达式 }}` 保持普通文本;`<input>`、`<table>` 等按 HTML 语义处理,ReactiveMD 组件不建立绑定。关闭全部开关会重新编译回默认模式。此政策是本版的过渡方案,后续版本再评估混合兼容。
|
|
15
|
+
|
|
16
|
+
开关是宿主能力设置,源码、参数状态文件和文档标签不能自行开启它们。Demo 始终显示当前模式,刷新页面后回到三个开关全部关闭的状态。
|
|
17
|
+
|
|
18
|
+
## 开关与 API
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { compileLocal } from 'reactive-md';
|
|
22
|
+
|
|
23
|
+
// Markdown、ReactiveMD 与 P0 HTML。
|
|
24
|
+
const reactive = compileLocal(source);
|
|
25
|
+
|
|
26
|
+
// 整篇按原生 HTML 处理;只允许作者 CSS。
|
|
27
|
+
const html = compileLocal(source, {
|
|
28
|
+
enableCss: true,
|
|
29
|
+
enableJavaScript: false,
|
|
30
|
+
enableExtendedHtml: false,
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| 选项 | 默认值 | 作用 |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| `enableCss` | `false` | 允许作者 CSS |
|
|
37
|
+
| `enableJavaScript` | `false` | 允许作者脚本和事件处理代码 |
|
|
38
|
+
| `enableExtendedHtml` | `false` | 允许 P1 标签、嵌入、表单、SVG/MathML 和整页 HTML 功能 |
|
|
39
|
+
|
|
40
|
+
选项必须是布尔值。开启一个开关不会顺带开启其他两个。带样式的扩展元素需要同时允许扩展 HTML 和 CSS;扩展元素中的脚本需要同时允许扩展 HTML 和 JavaScript。内置组件使用的样式、交互代码、图表 SVG 和公式 MathML 不受作者能力开关影响。
|
|
41
|
+
|
|
42
|
+
现有源码长度和 `limits.maxSyntaxNodes` 预算继续生效。HTML 路径按解析遍历的节点计数,嵌套 `srcdoc` 共用累计预算。
|
|
43
|
+
|
|
44
|
+
React 快捷组件通过 `compileOptions` 接收同样的设置:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<LocalReactiveDocument
|
|
48
|
+
source={source}
|
|
49
|
+
compileOptions={{ enableCss: true }}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
底层宿主把 `compileLocal` 生成的文档交给 `LocalDocumentView`。原生 HTML 文档的 `document.html` 记录三个归一化开关;参数和绑定集合为空。该字段属于运行时元数据,保存文档时保留原始源码和宿主设置。
|
|
54
|
+
|
|
55
|
+
## 默认支持的 P0 HTML
|
|
56
|
+
|
|
57
|
+
| 用途 | 标签 |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| 行内文字 | `b`、`strong`、`i`、`em`、`s`、`del`、`u`、`mark`、`sup`、`sub` |
|
|
60
|
+
| 换行与分隔 | `br`、`hr` |
|
|
61
|
+
| 段落与标题 | `p`、`h1` 至 `h6` |
|
|
62
|
+
| 容器 | `div`、`span` |
|
|
63
|
+
| 折叠内容 | `details`、`summary` |
|
|
64
|
+
| 引用 | `blockquote` |
|
|
65
|
+
| 代码 | `code`、`pre`、`pre` 内的 `code` |
|
|
66
|
+
| 列表 | `ul`、`ol`、`li`,含 `ol[start]` |
|
|
67
|
+
| 链接与图片 | `a`、`img`,沿用默认路径的 URL 策略 |
|
|
68
|
+
| 其他写法 | HTML 注释、命名及数字字符引用、HTML 大小写和空元素写法 |
|
|
69
|
+
|
|
70
|
+
容器中的正文继续解析 Markdown、公式、插值和 ReactiveMD 控件;`code`、`pre` 中的内容按字面显示。`details` 复用现有折叠组件的主题和交互,支持富文本标题、嵌套和 `open`,静态模式展开正文。HTML 布尔属性按存在与否判断,因此 `open="false"` 仍表示展开;现有 ReactiveMD 组件的布尔值规则保持不变。
|
|
71
|
+
|
|
72
|
+
可运行示例见 [HTML 与 ReactiveMD](../examples/local/html-compat.reactive.md)。
|
|
73
|
+
|
|
74
|
+
通用属性按允许列表接收,支持文档标识、标题、语言、方向和可访问性属性。默认模式中的作者 `style`、事件处理属性及不支持的标签保持惰性源码或产生定位诊断。图片仍需宿主明确允许后才加载。代码与不支持区域不执行脚本。
|
|
75
|
+
|
|
76
|
+
## 扩展 HTML
|
|
77
|
+
|
|
78
|
+
`enableExtendedHtml` 管理以下作者语法:
|
|
79
|
+
|
|
80
|
+
- 表格及结构:`table`、`caption`、`thead`、`tbody`、`tfoot`、`tr`、`th`、`td`。
|
|
81
|
+
- 定义列表:`dl`、`dt`、`dd`。
|
|
82
|
+
- 补充文字语义:`small`、`kbd`、`samp`、`var`、`abbr`、`q`、`cite`、`ins`。
|
|
83
|
+
- 图文和结构:`figure`、`figcaption`、`article`、`section`、`aside`、`header`、`footer`、`ruby`、`rt`、`rp`、`wbr`。
|
|
84
|
+
- 原生表单、`iframe`、`object`、`embed`、`dialog`、任意 SVG/MathML 和整页 HTML 功能。
|
|
85
|
+
|
|
86
|
+
在默认模式中,已有的 ReactiveMD `<table>`、`<section>`、`<input>`、`<select>` 等组件继续采用当前语义。在原生 HTML 模式中,同名元素采用浏览器语义。
|
|
87
|
+
|
|
88
|
+
## 隔离与导出
|
|
89
|
+
|
|
90
|
+
作者 HTML 放在不带 `allow-same-origin` 的沙箱 iframe 中。源码中的整页结构、样式和脚本作用于该隔离文档。资源加载、表单提交和导航仍受 CSP 与沙箱限制;启用扩展 HTML 不代表获得全部网络能力。
|
|
91
|
+
|
|
92
|
+
本版支持内联 CSS 和 JavaScript,自动外部资源请求仍受限:外部脚本、样式表、图片、媒体及嵌入资源不会因开启开关而自动加载。扩展 HTML 允许隔离文档中的 HTTP(S) 表单提交和 `<base>` 地址解析,保留顶层导航与宿主访问限制。iframe 可用 `srcdoc` 提供内联内容;`object`、`embed` 的外部资源仍受 CSP 限制。
|
|
93
|
+
|
|
94
|
+
启用任意 JavaScript 后,脚本可以动态创建元素和样式,另两个开关主要约束作者源码。宿主隔离仍有效,但这些开关不承诺逐项阻止脚本的运行时 DOM 操作。
|
|
95
|
+
|
|
96
|
+
交互导出保留本次编译选项和文档路径。原生 HTML 的静态导出保留浏览器内建的折叠和表单行为,并禁用作者 JavaScript。这类文档没有可保存的 ReactiveMD 参数。旧导出载荷省略编译选项时采用三个开关全部关闭的默认行为。
|
|
97
|
+
|
|
98
|
+
相关规则见[集成说明](local-integration-ch.md)、[可分享导出](shareable-export-ch.md)和[安全约定](../SECURITY-ch.md)。
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Partial HTML compatibility and temporary routing policy
|
|
2
|
+
|
|
3
|
+
This feature targets the next release. Documents use Markdown, ReactiveMD controls and expressions by default, with the P0 HTML subset below. Host applications can enable author CSS, JavaScript and extended HTML separately. All three options default to `false`.
|
|
4
|
+
|
|
5
|
+
## Temporary routing policy
|
|
6
|
+
|
|
7
|
+
This release routes whole documents to avoid mixed parsing and rendering conflicts between author CSS, JavaScript, extended HTML and ReactiveMD.
|
|
8
|
+
|
|
9
|
+
| Compile options | Document behavior |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| All three options omitted or `false` | ReactiveMD parsing and the existing React renderer, including P0 HTML |
|
|
12
|
+
| Any option `true` | Native HTML for the entire source, rendered in an isolated iframe |
|
|
13
|
+
|
|
14
|
+
In native HTML mode, `# headings`, `**emphasis**`, LaTeX and `{{ expressions }}` remain ordinary text. Elements such as `input` and `table` use HTML semantics. ReactiveMD components establish no bindings. Turning all options off recompiles the document in the default mode. This is a transitional policy for this release; mixed compatibility can be evaluated later.
|
|
15
|
+
|
|
16
|
+
Options are host capabilities. Source tags and parameter state files cannot grant them. The demo displays the active mode and resets all three capabilities when the page reloads.
|
|
17
|
+
|
|
18
|
+
## Options and API
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { compileLocal } from 'reactive-md';
|
|
22
|
+
|
|
23
|
+
// Markdown, ReactiveMD and P0 HTML.
|
|
24
|
+
const reactive = compileLocal(source);
|
|
25
|
+
|
|
26
|
+
// Native HTML for the entire source; author CSS is enabled.
|
|
27
|
+
const html = compileLocal(source, {
|
|
28
|
+
enableCss: true,
|
|
29
|
+
enableJavaScript: false,
|
|
30
|
+
enableExtendedHtml: false,
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| Option | Default | Capability |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| `enableCss` | `false` | Author CSS |
|
|
37
|
+
| `enableJavaScript` | `false` | Author scripts and event handlers |
|
|
38
|
+
| `enableExtendedHtml` | `false` | P1 elements, embeds, forms, SVG/MathML and whole-page HTML features |
|
|
39
|
+
|
|
40
|
+
Each option must be boolean. Enabling one does not enable the others. Styled extended elements require both extended HTML and CSS; scripts in extended elements require both extended HTML and JavaScript. Built-in styles, interactions, chart SVG and formula MathML continue to work independently of these author capabilities.
|
|
41
|
+
|
|
42
|
+
Source-length limits and `limits.maxSyntaxNodes` still apply. The HTML path counts traversed parse-tree nodes, with a cumulative budget shared by nested `srcdoc` documents.
|
|
43
|
+
|
|
44
|
+
The React convenience component accepts the same settings through `compileOptions`:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<LocalReactiveDocument
|
|
48
|
+
source={source}
|
|
49
|
+
compileOptions={{ enableCss: true }}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Lower-level hosts pass the compiled document to `LocalDocumentView`. Native HTML documents have a `document.html` field with the three normalized flags and empty parameter and binding collections. This field is runtime metadata. Store the original source and host settings when saving a document.
|
|
54
|
+
|
|
55
|
+
## P0 HTML in the default mode
|
|
56
|
+
|
|
57
|
+
| Purpose | Elements |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| Inline text | `b`, `strong`, `i`, `em`, `s`, `del`, `u`, `mark`, `sup`, `sub` |
|
|
60
|
+
| Breaks | `br`, `hr` |
|
|
61
|
+
| Paragraphs and headings | `p`, `h1` through `h6` |
|
|
62
|
+
| Containers | `div`, `span` |
|
|
63
|
+
| Disclosures | `details`, `summary` |
|
|
64
|
+
| Quotations | `blockquote` |
|
|
65
|
+
| Code | `code`, `pre`, and `code` inside `pre` |
|
|
66
|
+
| Lists | `ul`, `ol`, `li`, including `ol[start]` |
|
|
67
|
+
| Links and images | `a`, `img`, using the default path's URL policy |
|
|
68
|
+
| Other forms | HTML comments, named and numeric character references, case-insensitive HTML names and void-element spelling |
|
|
69
|
+
|
|
70
|
+
Container bodies continue to parse Markdown, formulas, interpolation and ReactiveMD controls. Code elements preserve literal content. `details` reuses the existing disclosure theme and interaction, with rich summaries, nesting and the `open` attribute. Static rendering expands the body. HTML boolean attributes use presence semantics, so `open="false"` still means open. Existing ReactiveMD component boolean rules stay unchanged.
|
|
71
|
+
|
|
72
|
+
See the runnable [HTML and ReactiveMD example](../examples/local/html-compat.reactive.md).
|
|
73
|
+
|
|
74
|
+
Common attributes use an allowlist for document identifiers, titles, language, direction and accessibility. Author styles, event-handler attributes and unsupported elements in the default mode remain inert source or produce positioned diagnostics. Images still require explicit host approval. Code and unsupported regions execute no scripts.
|
|
75
|
+
|
|
76
|
+
## Extended HTML
|
|
77
|
+
|
|
78
|
+
`enableExtendedHtml` controls the following author syntax:
|
|
79
|
+
|
|
80
|
+
- Tables and their structure: `table`, `caption`, `thead`, `tbody`, `tfoot`, `tr`, `th`, `td`.
|
|
81
|
+
- Definition lists: `dl`, `dt`, `dd`.
|
|
82
|
+
- Additional text semantics: `small`, `kbd`, `samp`, `var`, `abbr`, `q`, `cite`, `ins`.
|
|
83
|
+
- Figures and structure: `figure`, `figcaption`, `article`, `section`, `aside`, `header`, `footer`, `ruby`, `rt`, `rp`, `wbr`.
|
|
84
|
+
- Native forms, `iframe`, `object`, `embed`, `dialog`, arbitrary SVG/MathML and whole-page HTML features.
|
|
85
|
+
|
|
86
|
+
In the default mode, existing ReactiveMD components such as `table`, `section`, `input` and `select` retain their current meanings. In native HTML mode, these names use browser semantics.
|
|
87
|
+
|
|
88
|
+
## Isolation and export
|
|
89
|
+
|
|
90
|
+
Author HTML runs inside a sandboxed iframe without `allow-same-origin`. Whole-page structure, styles and scripts apply to this isolated document. CSP and sandbox restrictions still govern resources, form submission and navigation. Extended HTML does not grant unrestricted network access.
|
|
91
|
+
|
|
92
|
+
This release supports inline CSS and JavaScript. Enabling the options does not automatically load external scripts, stylesheets, images, media or embedded resources. Extended HTML permits HTTP(S) form submission and `base` URL resolution inside the isolated document while retaining host-access and top-navigation restrictions. Iframes can use `srcdoc` for inline content; external `object` and `embed` resources remain subject to CSP.
|
|
93
|
+
|
|
94
|
+
Once arbitrary JavaScript is enabled, scripts can create elements and styles dynamically. The other options primarily constrain author source; they do not promise to block individual runtime DOM operations. Host isolation remains in place.
|
|
95
|
+
|
|
96
|
+
Interactive export preserves compile options and the selected rendering path. Native HTML static export retains built-in browser disclosure and form behavior while disabling author JavaScript. These documents have no ReactiveMD parameters to save. Older export payloads without compile options use the default with all three capabilities off.
|
|
97
|
+
|
|
98
|
+
See [integration](local-integration-en.md), [shareable export](shareable-export-en.md) and [security](../SECURITY.md).
|
package/docs/local-guide-ch.md
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
| --- | --- |
|
|
54
54
|
| Markdown 标题、段落、列表、引用、链接、图片 | 原样使用 |
|
|
55
55
|
| Markdown 表格 | 原样使用;也可以放进 `<table>` 获得搜索和排序 |
|
|
56
|
-
| HTML 标签 |
|
|
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 注释 `<!-- ... -->`
|
|
211
|
+
HTML 注释 `<!-- ... -->` 会被忽略,不产生组件或变量。正文支持无属性的 `<b>粗体</b>`、`<i>斜体</i>`、`<u>下划线</u>`、`<s>删除线</s>`、`<mark>高亮</mark>` 和 `<br>`(也接受 `<br/>`),这些格式可以嵌套。其他内容使用 Markdown 或对应组件。结构完整的未知标签会保留为源码文本并给出警告,内部标签和插值也按原文显示。事件、`style` 等属性不会获得执行能力。
|
|
212
212
|
|
|
213
|
-
|
|
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
|
|
package/docs/local-guide-en.md
CHANGED
|
@@ -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
|
|
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.
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## 运行环境与入口
|
|
6
6
|
|
|
7
|
+
下个发行版的 P0 HTML 和三个宿主能力开关见 [HTML 部分兼容](html-compatibility-ch.md)。本版采用暂时性分流政策:任意开启作者 CSS、JavaScript 或扩展 HTML,整篇文档即按原生 HTML 渲染,停止解析 Markdown 和 ReactiveMD。
|
|
8
|
+
|
|
7
9
|
| 入口 | 内容 | 依赖 |
|
|
8
10
|
| --- | --- | --- |
|
|
9
11
|
| `reactive-md` | `compileLocal`、`createLocalRuntime`、表达式与数学工具 | 不依赖 React |
|
|
@@ -42,6 +44,7 @@ export function Article() {
|
|
|
42
44
|
| 属性 | 类型 | 组件 | 说明 |
|
|
43
45
|
| --- | --- | --- | --- |
|
|
44
46
|
| `source` | `string` | `LocalReactiveDocument` | 源码变化时重新编译并创建新运行时;旧实例状态不保留。见[源码变化时保留参数](#源码变化时保留参数) |
|
|
47
|
+
| `compileOptions` | `LocalCompileOptions` | `LocalReactiveDocument` | 单次编译预算和 HTML 能力开关;省略时使用默认 ReactiveMD 模式 |
|
|
45
48
|
| `document` | `LocalDocument` | `LocalDocumentView` | 已编译文档;由宿主编译一次 |
|
|
46
49
|
| `runtime` | `LocalRuntime` | `LocalDocumentView` | 宿主创建并负责销毁 |
|
|
47
50
|
| `onDiagnostics` | `(diagnostics: Diagnostic[]) => void` | 两者 | 接收编译诊断和控件写入被拒绝时的运行时诊断 |
|
|
@@ -357,7 +360,7 @@ const urlPolicy: LocalUrlPolicy = (raw, kind) => {
|
|
|
357
360
|
|
|
358
361
|
## 不提供的功能
|
|
359
362
|
|
|
360
|
-
|
|
363
|
+
默认 ReactiveMD 路径支持 P0 HTML。作者 CSS、JavaScript 和扩展 HTML 的宿主开关使用独立的原生 HTML 路径,见 [HTML 部分兼容](html-compatibility-ch.md)。本地模式仍不提供自动状态持久化或不受限的网络访问、插件或自定义组件注册、外部数据接口、Vue 支持、React 18 支持或 CommonJS 入口。状态导出与导入是宿主的显式调用。`LocalReactiveDocument` 在源码变化时从初值开始;需要保留参数时使用保留工具,或自行管理运行时和文档。
|
|
361
364
|
|
|
362
365
|
|
|
363
366
|
新增组块、颜色、槽位状态与迁移规则见[local-draft-2 扩展说明](local-components-v2-ch.md),升级清单见[0.4.0 发布与迁移](release-0.4.0-ch.md)。`0.4.0` 是 `next` 渠道的预览版。
|
|
@@ -4,6 +4,8 @@ Local interaction mode uses HTML-style tags, in-place parameters and `{{ express
|
|
|
4
4
|
|
|
5
5
|
## Runtime and entries
|
|
6
6
|
|
|
7
|
+
See [HTML compatibility](html-compatibility-en.md) for the next release's P0 HTML support and host capability options. The temporary routing policy sends the entire document to native HTML when author CSS, JavaScript or extended HTML is enabled. Markdown and ReactiveMD interpretation stop in that path.
|
|
8
|
+
|
|
7
9
|
| Entry | Contents | Dependency |
|
|
8
10
|
| --- | --- | --- |
|
|
9
11
|
| `reactive-md` | `compileLocal`, `createLocalRuntime`, expression and math utilities | No React dependency |
|
|
@@ -42,6 +44,7 @@ export function Article() {
|
|
|
42
44
|
| Prop | Type | Component | Notes |
|
|
43
45
|
| --- | --- | --- | --- |
|
|
44
46
|
| `source` | `string` | `LocalReactiveDocument` | Recompiles and creates a new runtime when the source changes; old instance state is not kept. See [Keeping values when source changes](#keeping-values-when-source-changes) |
|
|
47
|
+
| `compileOptions` | `LocalCompileOptions` | `LocalReactiveDocument` | Per-compilation limits and HTML capability flags; omitted options use the default ReactiveMD path |
|
|
45
48
|
| `document` | `LocalDocument` | `LocalDocumentView` | Compiled document; compiled once by the host |
|
|
46
49
|
| `runtime` | `LocalRuntime` | `LocalDocumentView` | Created by the host, which is responsible for disposal |
|
|
47
50
|
| `onDiagnostics` | `(diagnostics: Diagnostic[]) => void` | Both | Receives compile diagnostics and runtime diagnostics when control writes are rejected |
|
|
@@ -357,7 +360,7 @@ These limits bound the work for a single document; they do not replace host cont
|
|
|
357
360
|
|
|
358
361
|
## Features not provided
|
|
359
362
|
|
|
360
|
-
Local mode
|
|
363
|
+
The default ReactiveMD path supports P0 HTML. Host options for author CSS, JavaScript and extended HTML use the separate native HTML path described in [HTML compatibility](html-compatibility-en.md). Local mode still provides no automatic state persistence or unrestricted network access, plugins or custom component registration, external data APIs, Vue support, React 18 support or a CommonJS entry. State export and import are explicit host calls. `LocalReactiveDocument` starts from initial values when the source changes; use retention helpers or manage the runtime and document yourself.
|
|
361
364
|
|
|
362
365
|
|
|
363
366
|
See [local-draft-2 components and migration](local-components-v2-en.md) for new tags, colors and slot state, and [0.4.0 release and migration](release-0.4.0-en.md) for the upgrade checklist. `0.4.0` is the preview release on the `next` channel.
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
## 1. 定位与范围
|
|
8
8
|
|
|
9
|
+
下个发行版新增的 P0 HTML 和作者能力开关见 [HTML 部分兼容](html-compatibility-ch.md)。本规范描述三个开关全部关闭的默认路径;任意开启作者 CSS、JavaScript 或扩展 HTML 时,按照暂时性分流政策将整篇源码交给原生 HTML 路径。
|
|
10
|
+
|
|
9
11
|
`0.4.0` 新增不可见的 `computed`/`const` 声明与数字、字符串、日期函数。声明语法、依赖与错误规则、函数签名及固定默认值见[复用计算与格式化数值](computations-formatting-ch.md)。
|
|
10
12
|
|
|
11
13
|
跨字段校验、条件样式、数组与有限表格行生成见[条件、校验与本地集合](constraints-collections-ch.md)。
|
|
@@ -96,6 +98,12 @@ Reactive MD 用于本地交互文档:作者写 Markdown、放置输入控件
|
|
|
96
98
|
|
|
97
99
|
### 3.4 代码、公式与转义
|
|
98
100
|
|
|
101
|
+
正文中的 `Array<T>`、`Map<string, number>`、`x<y` 和货币 `$5`、`$10` 按文字处理;完整公式仍使用 `$...$` 或 `$$...$$`。单个未配对美元符号按文字显示。
|
|
102
|
+
|
|
103
|
+
默认路径支持 [P0 HTML 清单](html-compatibility-ch.md#默认支持的-p0-html)中的文字格式、标题、容器、折叠、引用、代码、列表、链接和图片。它们生成受控节点,复用现有主题和渲染方式。普通单换行仍按 Markdown 软换行处理。
|
|
104
|
+
|
|
105
|
+
脚注用 `[^note]` 引用,定义写为 `[^note]: 内容`,续写段落、列表和代码块按 Markdown 缩进。定义支持 Markdown 与上述基础 HTML。按首次引用顺序生成文末编号列表,重复引用共享编号并分别提供返回链接;标识符不区分大小写,重复定义采用第一条。未定义引用保留为文字,未引用定义不显示。脚注内的控件和插值保持为文字,不建立绑定或执行表达式。
|
|
106
|
+
|
|
99
107
|
行内代码和代码围栏内的标签、插值、公式标记全部按原文显示。前导区中的源码修订指令是会被识别的版本注释;其他 Markdown 注释 `<!-- ... -->` 不产生组件或变量。
|
|
100
108
|
|
|
101
109
|
正文用 `\{{` 显示字面量 `{{`,用 `\<slider>` 或行内代码显示标签示例。反斜杠的这类转义只属于 Markdown 上下文,不应用到 LaTeX 源码。
|
|
@@ -447,13 +455,12 @@ node.id 为当前图解内唯一的 `[A-Za-z_][A-Za-z0-9_-]*`。edge 必填 from
|
|
|
447
455
|
|
|
448
456
|
## 13. 诊断与验收规则
|
|
449
457
|
|
|
450
|
-
诊断包含严重程度、类别、简短解释、源码行列与修复建议。结构完整的未知标签区域按转义后的原始源码显示,给出 `local.component.unknown`
|
|
458
|
+
诊断包含严重程度、类别、简短解释、源码行列与修复建议。结构完整的未知标签区域按转义后的原始源码显示,给出 `local.component.unknown` 警告,内部控件和插值不执行。正常脚注不产生不支持警告。其他正文与交互继续工作。无法可靠恢复的组件标签结构、已知组件的属性或表达式错误、绑定错误和资源预算问题仍阻止编译。运行时局部计算错误按第 5 节隔离。
|
|
451
459
|
|
|
452
460
|
| 类别 | 例子 | 应说明什么 |
|
|
453
461
|
| --- | --- | --- |
|
|
454
462
|
| 标签结构 | card 未闭合、错误嵌套 | 需要的结束标签及开始位置 |
|
|
455
463
|
| 未知标签警告 | slidr | 未知名称、拼写建议以及局部源码降级 |
|
|
456
|
-
| 脚注警告 | `[^note]` 和脚注定义 | 原文保留,尚未支持脚注排版 |
|
|
457
464
|
| 非法语法 | on-click、actions 配置块 | 属性或旧语法不在当前模式 |
|
|
458
465
|
| 绑定 | 引用 seats,但只声明 seat | 不存在的参数及候选名称 |
|
|
459
466
|
| 初值 | 同名参数写两次 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
|
+
The default path accepts the [P0 HTML subset](html-compatibility-en.md#p0-html-in-the-default-mode): text formatting, headings, containers, disclosures, quotations, code, lists, links and images. It produces controlled nodes and reuses the current theme and renderer. Ordinary single newlines remain Markdown soft breaks. Under the temporary routing policy, enabling author CSS, JavaScript or extended HTML sends the entire source to native HTML and stops Markdown and ReactiveMD interpretation.
|
|
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;
|
|
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 |
|
package/docs/release-0.4.1-ch.md
CHANGED
|
@@ -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)。
|
package/docs/release-0.4.1-en.md
CHANGED
|
@@ -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)。
|