reactive-md 0.9.3 → 0.10.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 (299) hide show
  1. package/CHANGELOG-ch.md +34 -0
  2. package/CHANGELOG.md +34 -0
  3. package/README-ch.md +7 -7
  4. package/README-en.md +7 -7
  5. package/README.md +7 -7
  6. package/THIRD_PARTY_NOTICES.md +0 -57
  7. package/cli/help.mjs +6 -4
  8. package/cli/init.mjs +1 -1
  9. package/cli/migrate.mjs +1 -1
  10. package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
  11. package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
  12. package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
  13. package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
  14. package/dist-library/authoring-Bwu_zCWs.js +768 -0
  15. package/dist-library/choice-values-BItGjPD2.js +58 -0
  16. package/dist-library/compile-B35rfzKr.js +1742 -0
  17. package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
  18. package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
  19. package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
  20. package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
  21. package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
  22. package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
  23. package/dist-library/conditional-branches-CIhJXasR.js +17 -0
  24. package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
  25. package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
  26. package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
  27. package/dist-library/data-table-CSAkm1eU.js +290 -0
  28. package/dist-library/data-table-model-DruztQFt.js +391 -0
  29. package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
  30. package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
  31. package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
  32. package/dist-library/default-options-By16CVw1.js +131 -0
  33. package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
  34. package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
  35. package/dist-library/display-Bb6hAG5T.js +2065 -0
  36. package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
  37. package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
  38. package/dist-library/font-aliases-CKYjwn4o.js +4 -0
  39. package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
  40. package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
  41. package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
  42. package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
  43. package/dist-library/layout-CPQggKxk.js +592 -0
  44. package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
  45. package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
  46. package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
  47. package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
  48. package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
  49. package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
  50. package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
  51. package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
  52. package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
  53. package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
  54. package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
  55. package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
  56. package/dist-library/reactive-md-authoring.js +277 -269
  57. package/dist-library/reactive-md-build.js +327 -33
  58. package/dist-library/reactive-md-compiler-session.js +3 -3
  59. package/dist-library/reactive-md-compiler-standard.js +10 -10
  60. package/dist-library/reactive-md-compiler.js +3 -3
  61. package/dist-library/reactive-md-contracts.js +4 -4
  62. package/dist-library/reactive-md-default-packs.js +4 -3
  63. package/dist-library/reactive-md-default-preset.js +3 -3
  64. package/dist-library/reactive-md-export.js +6 -6
  65. package/dist-library/reactive-md-minimal-preset.js +3 -2
  66. package/dist-library/reactive-md-minimal-react-preset.js +18 -17
  67. package/dist-library/reactive-md-minimal.css +1 -1
  68. package/dist-library/reactive-md-observability.js +2 -2
  69. package/dist-library/reactive-md-pack-style-manifest.js +8 -0
  70. package/dist-library/reactive-md-plugin-chart.js +13 -9
  71. package/dist-library/reactive-md-plugin-data.js +4 -4
  72. package/dist-library/reactive-md-plugin-diagram.js +3 -3
  73. package/dist-library/reactive-md-plugin-forms.js +5 -5
  74. package/dist-library/reactive-md-plugin-gallery.js +3 -3
  75. package/dist-library/reactive-md-plugin-navigation.js +10 -10
  76. package/dist-library/reactive-md-plugin-network.js +5 -5
  77. package/dist-library/reactive-md-plugin-plot.js +4 -4
  78. package/dist-library/reactive-md-react-component-accordion.js +3 -3
  79. package/dist-library/reactive-md-react-component-alert.js +3 -3
  80. package/dist-library/reactive-md-react-component-anchor.js +3 -3
  81. package/dist-library/reactive-md-react-component-badge.js +3 -3
  82. package/dist-library/reactive-md-react-component-card.js +3 -3
  83. package/dist-library/reactive-md-react-component-chart.js +2 -2
  84. package/dist-library/reactive-md-react-component-checkbox.js +2 -2
  85. package/dist-library/reactive-md-react-component-checklist.js +2 -2
  86. package/dist-library/reactive-md-react-component-choices.js +2 -2
  87. package/dist-library/reactive-md-react-component-column.js +1 -1
  88. package/dist-library/reactive-md-react-component-coordinate.js +2 -2
  89. package/dist-library/reactive-md-react-component-counter.js +2 -2
  90. package/dist-library/reactive-md-react-component-data-table.js +2 -2
  91. package/dist-library/reactive-md-react-component-date.js +2 -2
  92. package/dist-library/reactive-md-react-component-diagram.js +2 -2
  93. package/dist-library/reactive-md-react-component-disclosure.js +3 -3
  94. package/dist-library/reactive-md-react-component-edge.js +1 -1
  95. package/dist-library/reactive-md-react-component-else.js +10 -0
  96. package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
  97. package/dist-library/reactive-md-react-component-gallery.js +2 -2
  98. package/dist-library/reactive-md-react-component-grid.js +3 -3
  99. package/dist-library/reactive-md-react-component-if.js +3 -3
  100. package/dist-library/reactive-md-react-component-input.js +2 -2
  101. package/dist-library/reactive-md-react-component-jump.js +3 -3
  102. package/dist-library/reactive-md-react-component-multi-select.js +2 -2
  103. package/dist-library/reactive-md-react-component-node.js +2 -2
  104. package/dist-library/reactive-md-react-component-number.js +2 -2
  105. package/dist-library/reactive-md-react-component-option.js +1 -1
  106. package/dist-library/reactive-md-react-component-panel.js +3 -3
  107. package/dist-library/reactive-md-react-component-plot.js +2 -2
  108. package/dist-library/reactive-md-react-component-progress.js +2 -2
  109. package/dist-library/reactive-md-react-component-quiz.js +2 -2
  110. package/dist-library/reactive-md-react-component-radio-group.js +2 -2
  111. package/dist-library/reactive-md-react-component-range-slider.js +2 -2
  112. package/dist-library/reactive-md-react-component-section.js +3 -3
  113. package/dist-library/reactive-md-react-component-select.js +2 -2
  114. package/dist-library/reactive-md-react-component-slider.js +2 -2
  115. package/dist-library/reactive-md-react-component-step.js +3 -3
  116. package/dist-library/reactive-md-react-component-steps.js +3 -3
  117. package/dist-library/reactive-md-react-component-tab.js +3 -3
  118. package/dist-library/reactive-md-react-component-table.js +2 -2
  119. package/dist-library/reactive-md-react-component-tabs.js +3 -3
  120. package/dist-library/reactive-md-react-component-text.js +3 -3
  121. package/dist-library/reactive-md-react-component-textarea.js +2 -2
  122. package/dist-library/reactive-md-react-component-timeline.js +2 -2
  123. package/dist-library/reactive-md-react-component-timer.js +2 -2
  124. package/dist-library/reactive-md-react-component-toggle.js +2 -2
  125. package/dist-library/reactive-md-react-component-tooltip.js +3 -3
  126. package/dist-library/reactive-md-react-component-validation.js +3 -3
  127. package/dist-library/reactive-md-react-minimal.js +4 -4
  128. package/dist-library/reactive-md-react-pack-controls.js +4 -4
  129. package/dist-library/reactive-md-react-pack-data.js +3 -3
  130. package/dist-library/reactive-md-react-pack-layout.js +25 -24
  131. package/dist-library/reactive-md-react-pack-visuals.js +2 -2
  132. package/dist-library/reactive-md-react-packed.js +6 -6
  133. package/dist-library/reactive-md-react-server.js +37 -36
  134. package/dist-library/reactive-md-react-static-server.js +2 -2
  135. package/dist-library/reactive-md-react-static.js +1 -1
  136. package/dist-library/reactive-md-react-unstyled.js +12 -12
  137. package/dist-library/reactive-md-react.js +12 -12
  138. package/dist-library/reactive-md-scan.js +1 -1
  139. package/dist-library/reactive-md-sdk.js +23 -9
  140. package/dist-library/reactive-md-standalone-configured.js +2 -2
  141. package/dist-library/reactive-md-standalone-host.js +2 -2
  142. package/dist-library/reactive-md-testing-browser.js +2 -2
  143. package/dist-library/reactive-md-testing-react.js +6 -6
  144. package/dist-library/reactive-md-testing.js +6 -6
  145. package/dist-library/reactive-md-vite.js +25 -9
  146. package/dist-library/reactive-md-worker-pool.js +3 -3
  147. package/dist-library/reactive-md.css +1 -1
  148. package/dist-library/reactive-md.js +52 -43
  149. package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
  150. package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
  151. package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
  152. package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
  153. package/dist-library/rmd-pack-layout.css +9 -0
  154. package/dist-library/rmd-pack-resource-layout.css +9 -0
  155. package/dist-library/runtime-BHeuLOv_.js +1369 -0
  156. package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
  157. package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
  158. package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
  159. package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
  160. package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
  161. package/dist-library/shareable-CHCDnl6j.js +844 -0
  162. package/dist-library/types/authoring/catalog.d.ts +3 -1
  163. package/dist-library/types/authoring/index.d.ts +1 -1
  164. package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
  165. package/dist-library/types/components/chart/default-chart.d.ts +7 -0
  166. package/dist-library/types/components/entries/else.d.ts +3 -0
  167. package/dist-library/types/components/layout/layout.d.ts +5 -0
  168. package/dist-library/types/components/shared/visuals.d.ts +1 -1
  169. package/dist-library/types/components/table/data-table-model.d.ts +95 -2
  170. package/dist-library/types/components/table/data-table.d.ts +2 -2
  171. package/dist-library/types/contracts/component-kernel.d.ts +5 -0
  172. package/dist-library/types/contracts/font-aliases.d.ts +18 -0
  173. package/dist-library/types/contracts/number-literal.d.ts +2 -0
  174. package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
  175. package/dist-library/types/export/index.d.ts +4 -1
  176. package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
  177. package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
  178. package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
  179. package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
  180. package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
  181. package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
  182. package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
  183. package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
  184. package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
  185. package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
  186. package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
  187. package/dist-library/types/local/evaluation/computations.d.ts +13 -5
  188. package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
  189. package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
  190. package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
  191. package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
  192. package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
  193. package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
  194. package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
  195. package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
  196. package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
  197. package/dist-library/types/local/evaluation/validation.d.ts +8 -6
  198. package/dist-library/types/local/index.d.ts +4 -3
  199. package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
  200. package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
  201. package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
  202. package/dist-library/types/local/runtime/runtime.d.ts +3 -1
  203. package/dist-library/types/local/runtime/state.d.ts +30 -15
  204. package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
  205. package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
  206. package/dist-library/types/local/source/authoring.d.ts +10 -0
  207. package/dist-library/types/local/source/source-migration.d.ts +1 -0
  208. package/dist-library/types/local/types.d.ts +33 -2
  209. package/dist-library/types/react/component-api.d.ts +21 -2
  210. package/dist-library/types/react/component-utils.d.ts +11 -0
  211. package/dist-library/types/react/font-aliases.d.ts +2 -0
  212. package/dist-library/types/react/package-core.d.ts +3 -0
  213. package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
  214. package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
  215. package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
  216. package/dist-library/types/react/sdk-core.d.ts +3 -1
  217. package/dist-library/types/sdk/assembly.d.ts +3 -0
  218. package/dist-library/types/sdk/font.d.ts +13 -0
  219. package/dist-library/types/sdk/index.d.ts +1 -0
  220. package/dist-library/types/sdk/theme.d.ts +5 -0
  221. package/dist-library/types/sdk/types.d.ts +6 -0
  222. package/dist-library/types/sdk/version.d.ts +1 -1
  223. package/dist-library/types/shareable.d.ts +15 -3
  224. package/dist-library/types/standalone/prepare.d.ts +4 -2
  225. package/dist-library/types/standalone/session-core.d.ts +4 -1
  226. package/dist-library/types/vite/index.d.ts +3 -0
  227. package/dist-library/types/vite/registration.d.ts +1 -0
  228. package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
  229. package/dist-library/types-FYhRWRn9.js +3 -0
  230. package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
  231. package/dist-library/validation-DRuW0Wl9.js +433 -0
  232. package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
  233. package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
  234. package/dist-library/visuals-7xzoL9ql.js +49340 -0
  235. package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
  236. package/dist-standalone/reactive-md-standalone.css +1 -1
  237. package/dist-standalone/reactive-md-standalone.js +128 -368
  238. package/docs/README-ch.md +3 -1
  239. package/docs/README.md +3 -1
  240. package/docs/compatibility/api-stability-ch.md +1 -1
  241. package/docs/compatibility/api-stability-en.md +1 -1
  242. package/docs/compatibility/compatibility-ch.md +15 -15
  243. package/docs/compatibility/compatibility-en.md +15 -15
  244. package/docs/compatibility/compatibility-manifest.schema.json +3 -2
  245. package/docs/compatibility/deprecation-ch.md +2 -2
  246. package/docs/compatibility/deprecation-en.md +2 -2
  247. package/docs/compatibility/source-versioning-ch.md +22 -14
  248. package/docs/compatibility/source-versioning-en.md +22 -13
  249. package/docs/compatibility/support-matrix-ch.md +4 -3
  250. package/docs/compatibility/support-matrix-en.md +4 -3
  251. package/docs/development/component-development-ch.md +2 -2
  252. package/docs/development/component-development-en.md +2 -2
  253. package/docs/development/component-protocol-ch.md +18 -18
  254. package/docs/development/component-protocol-en.md +14 -14
  255. package/docs/guides/local-guide-ch.md +109 -20
  256. package/docs/guides/local-guide-en.md +109 -20
  257. package/docs/integration/author-tools-ch.md +1 -1
  258. package/docs/integration/author-tools-en.md +1 -1
  259. package/docs/integration/editor-ch.md +3 -3
  260. package/docs/integration/editor-en.md +3 -3
  261. package/docs/integration/extension-sdk-ch.md +29 -3
  262. package/docs/integration/extension-sdk-en.md +29 -3
  263. package/docs/integration/local-integration-ch.md +3 -3
  264. package/docs/integration/local-integration-en.md +3 -3
  265. package/docs/integration/pdf-export-ch.md +42 -0
  266. package/docs/integration/pdf-export-en.md +42 -0
  267. package/docs/integration/shareable-export-ch.md +11 -19
  268. package/docs/integration/shareable-export-en.md +11 -19
  269. package/docs/reference/diagnostics-counting-ch.md +24 -1
  270. package/docs/reference/diagnostics-counting-en.md +24 -1
  271. package/docs/reference/local-interaction-syntax-ch.md +222 -33
  272. package/docs/reference/local-interaction-syntax-en.md +220 -31
  273. package/docs/reference/public-api-ch.md +24 -18
  274. package/docs/reference/public-api-en.md +24 -18
  275. package/docs/reference/theme-protocol-ch.md +1 -1
  276. package/docs/reference/theme-protocol-en.md +1 -1
  277. package/docs/releases/release-0.10.0-ch.md +45 -0
  278. package/docs/releases/release-0.10.0-en.md +45 -0
  279. package/examples/conformance/README-ch.md +3 -3
  280. package/examples/conformance/README.md +3 -3
  281. package/examples/conformance/local-draft-4.json +441 -0
  282. package/examples/integration/README-ch.md +3 -3
  283. package/examples/integration/README.md +3 -3
  284. package/examples/integration/chat-session/package.json +1 -1
  285. package/examples/local/README-ch.md +1 -1
  286. package/examples/local/README.md +1 -1
  287. package/package.json +6 -1
  288. package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
  289. package/dist-library/authoring-B14SsOXZ.js +0 -893
  290. package/dist-library/compile-D50B5_Ww.js +0 -1249
  291. package/dist-library/computations-CffoW7Ff.js +0 -340
  292. package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
  293. package/dist-library/default-options-DU5dxuU6.js +0 -125
  294. package/dist-library/layout-BfUzzO2b.js +0 -553
  295. package/dist-library/runtime-CuJndKqK.js +0 -1289
  296. package/dist-library/shareable-C6mUerpQ.js +0 -817
  297. package/dist-library/types-daDo2c_w.js +0 -3
  298. package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
  299. package/dist-library/visuals-CoVSjVD8.js +0 -49159
@@ -4,7 +4,7 @@
4
4
 
5
5
  Add controls to Markdown, and the prose, calculations and charts update as the reader changes them. Open the [online Playground](https://yaozi.raricy.com/) and paste an example into the editor to try it in the preview.
6
6
 
7
- This guide uses the current working tree with syntax revision `local-draft-3`. Each section starts with a runnable example, then explains it. The complete tag reference is at the end.
7
+ This guide uses the current working tree with syntax revision `local-draft-4`. Each section starts with a runnable example, then explains it. The complete tag reference is at the end.
8
8
 
9
9
  ## 1. Your first interactive document
10
10
 
@@ -60,7 +60,7 @@ Tags have two forms:
60
60
 
61
61
  Every input needs a `label`. Add `bind` when other content needs the value. When nothing reads the control, omit `bind`; for example, `<timer label="Focus" duration="60">` still works on its own.
62
62
 
63
- Parameter names use letters, digits and underscores, start with a letter or underscore, and are case-sensitive. `x`, `y`, `pi`, `e` and built-in function names are reserved. Put display text in `label`.
63
+ Parameter names use letters, digits and underscores, start with a letter or underscore, and are case-sensitive. `x`, `y`, `pi`, `e` and the older built-in function names are reserved. The draft-4 helpers (`number`, `string`, `range`, `join`, `split`, `dateAdd`, `formatDate`, `ifBlank`) and the transforms (`filter`, `map`, `sortBy`) may also be parameter names; `name(` calls the function and a bare name reads the parameter. Put display text in `label`.
64
64
 
65
65
  Controls that share a parameter must have the same type. Numeric controls must also match `min`, `max` and `step`, and the parameter gets only one explicit `initial`.
66
66
 
@@ -108,6 +108,28 @@ Array indexes start at 0, so `fees[0]` is the first item. Negative indexes and i
108
108
 
109
109
  Arrays cannot be interpolated directly in `{{ }}`. Convert them with `len`, an index or an aggregate function. An array can hold only one type: all numbers or all strings.
110
110
 
111
+ ### Filtering, mapping and sorting arrays
112
+
113
+ `filter`, `map` and `sortBy` derive a new array from an existing one.
114
+
115
+ ```markdown
116
+ <const name="routes" value="{{ ['ridge', 'town', 'forest'] }}">
117
+ <const name="distances" value="{{ [35.5, 48, 26] }}">
118
+
119
+ <computed name="open" value="{{ filter(routes, item != 'forest') }}">
120
+ <computed name="ranked" value="{{ sortBy(map(distances, round(item * 1.2, 1)), item, 'desc') }}">
121
+
122
+ <select bind="route" label="Route" options="{{ open }}"></select>
123
+
124
+ Open routes: {{ len(open) }}. Longest distance: {{ ranked[0] }}.
125
+ ```
126
+
127
+ `filter` keeps the items whose boolean condition is true. `map` replaces each item with the projection. `sortBy` orders items by a key, ascending by default or `'desc'` for a descending order. The second argument runs with `item` (the current element) and `index` (its zero-based position); other names such as `round` resolve as usual. A transform nested inside another transform gives its condition, projection or key its own `item` and `index`.
128
+
129
+ The source must be a string array or a number array. A condition must be a boolean; a projection or key must be a string or a number, and all projections or sort keys must be one kind. `filter` and `sortBy` keep the source element type, `map` takes the projection type. Results work anywhere an array works: `options`, `rows`, `len`, indexing, `join`, aggregates and other transforms. Text interpolation needs a scalar, so wrap an array in `len`, `join` or an index.
130
+
131
+ Document limits keep transforms bounded: up to 10,000 elements per array, 50,000 condition, projection or key evaluations per expression, three nested transform levels, and a 100,000 UTF-16-unit budget for string-array content, including temporary sort keys.
132
+
111
133
  ## 4. Expressions
112
134
 
113
135
  Expressions in `{{ }}` run locally. The language does not execute JavaScript or make network requests.
@@ -129,6 +151,7 @@ Common expression forms:
129
151
  | Arithmetic | `+ - * / %` | `people * 100` |
130
152
  | Comparison | `== != < <= > >=` | `people >= 5` |
131
153
  | Logic | `! && \|\|` | `people > 0 && people < 10` |
154
+ | Nullish coalescing | `a ?? b` | `picked ?? 'Nothing picked yet'` |
132
155
  | Conditional | `condition ? valueWhenTrue : valueWhenFalse` | `annual ? 80 : 100` |
133
156
  | Functions | Math, string, date and formatting functions | `round(2.6)`, `len(topics)` |
134
157
 
@@ -149,6 +172,20 @@ Formatted amount: {{ formatCurrency(1234.5, 'USD', 2, 'en-US') }}
149
172
 
150
173
  `formatCurrency` takes a value, currency code, number of decimal places and locale. `formatNumber`, `formatPercent` and `formatScientific` follow the same pattern.
151
174
 
175
+ Conversions, text arrays and dates are also built in:
176
+
177
+ ```markdown
178
+ Parsed: {{ number('12.5') * 2 }}
179
+ Text: {{ string(3) }}
180
+ Rounded: {{ round(1.2345, 2) }}
181
+ Months: {{ join(range(1, 4), ', ') }}
182
+ Second part: {{ split('a,b,c', ',')[1] }}
183
+ Due: {{ dateAdd('2026-01-30', 3) }}
184
+ Readable: {{ formatDate('2026-02-02') }}
185
+ ```
186
+
187
+ `number(text)` accepts decimal or scientific text; `string(value)` converts a scalar back to text. `join` combines a string or numeric array, `split` creates one, and `range(start, end)` creates a numeric array without the end value. `round(value, digits)` rounds numerically, `dateAdd` adds days or another supported time unit, and `formatDate` uses a supported locale. `ifBlank(text, fallback)` returns the fallback when the trimmed text is empty; `??` takes the right side only when the left side is null, so `0`, `false` and empty strings pass through.
188
+
152
189
  Division by zero, a type error or a non-finite result shows "Unable to calculate" in that spot while other content keeps updating. In a Markdown table, escape logical OR `||` as `\|\|`.
153
190
 
154
191
  ## 5. Input controls
@@ -190,6 +227,8 @@ When `initial` is omitted, defaults differ by control:
190
227
 
191
228
  An `option`'s `value` is the value exposed to expressions; the label text is display only. Set `initial` to an option's `value` to choose a different default.
192
229
 
230
+ A selector can also take its options from a string array with `options="{{ expression }}"` instead of `<option>` children. Each string is both the value and the label, and the two forms cannot be combined; section 6 shows an example.
231
+
193
232
  `multi-select` requires `label`, and `max-selected` limits how many options the reader can choose. `checklist` uses `[ ]` and `[x]` for initial states and exposes an array of checked item IDs.
194
233
 
195
234
  Use `range-slider` for a range and `coordinate` for a two-dimensional point. They expose two numbers through `bind-start`/`bind-end` and `bind-x`/`bind-y`.
@@ -215,6 +254,31 @@ A chart reads a Markdown table. Put labels in the first column and write numeric
215
254
 
216
255
  Charts update automatically. For search, sorting and paging, place the same Markdown table inside `<table label="Catalog">...</table>`.
217
256
 
257
+ ### Generated rows, formats and options
258
+
259
+ Generated data comes from arrays instead of Markdown table cells. `data-table` builds a table, and `chart` does the same when you add `rows`. Both give each row `item` (the current value) and `index` (its position).
260
+
261
+ ```markdown
262
+ <const name="months" value="{{ ['Jan', 'Feb', 'Mar'] }}">
263
+
264
+ <select bind="month" label="Focus month" options="{{ months }}"></select>
265
+
266
+ <data-table label="Fee plan" rows="{{ months }}" key="{{ item }}" bind="picked" searchable sortable page-size="2">
267
+ <column label="Month" value="{{ item }}">
268
+ <column label="Fee" value="{{ index * 100 + 100 }}" format="currency" digits="0" align="right">
269
+ <column label="Share" value="{{ (index + 1) / 3 }}" format="percent" summary="average">
270
+ </data-table>
271
+
272
+ <chart kind="bar" title="Fee by month" rows="{{ months }}">
273
+ <column label="Month" value="{{ item }}">
274
+ <column label="Fee" value="{{ index * 100 + 100 }}" format="currency" digits="0">
275
+ </chart>
276
+ ```
277
+
278
+ `data-table` adds search with `searchable`, sorting with `sortable` and paging with `page-size`. A static `empty` replaces the default placeholder when there are no rows; a search that matches no row keeps the no-matching-results message. `key` names the stable row value, and selecting a row writes it to `picked`. A `chart` with `rows` reads `<column>` children instead of a Markdown table. A column's `format` changes display text only; sorting, chart values and calculations still use the raw number. `align` sets a fixed alignment (`left`, `center` or `right`) for the table or one column; tables default to `center`. `row-align` chooses a body row's alignment from a full `{{ }}` expression with `item` and `index`. A column's `align` wins over `row-align`, which wins over the table's `align`; selection cells stay centered. `summary="sum"` or `summary="average"` on a numeric column adds that value to the footer using the column's format, and an average with no numeric cells shows nothing. `options` fills a selector from a string array: each string is both the value and the label, it cannot be combined with `<option>` children, and a single-choice selector takes the first option when the list becomes available.
279
+
280
+ This version formats generated columns and chart readouts. Static Markdown table cells and chart axes keep their plain display.
281
+
218
282
  ### Function curves
219
283
 
220
284
  Plots use LaTeX. Each `$$...$$` block defines one curve: explicit `y = f(x)`, a parametric `cases` block, or an implicit equation in `x` and `y`.
@@ -322,21 +386,22 @@ These alignments work in the default mode without enabling CSS or extended HTML.
322
386
 
323
387
  ## 8. Advanced features
324
388
 
325
- ### if and alert
389
+ ### if and else
326
390
 
327
391
  ```markdown
328
392
  <number bind="people" label="People" initial="3" min="1" max="30">
329
393
 
330
394
  <if when="{{ people >= 5 }}">
331
- <alert tone="success" title="Group discount">
332
395
  At 5 or more people, you can request group pricing.
333
- </alert>
334
396
  </if>
397
+ <else>
398
+ Standard pricing applies below five people.
399
+ </else>
335
400
  ```
336
401
 
337
402
  `if` requires a complete boolean interpolation in `when`, such as `when="{{ people >= 5 }}"`. It shows its content when the condition is true and hides it when false.
338
403
 
339
- `alert` is a callout block. `tone` accepts `info`, `success`, `warning` or `error` and defaults to `info`; `error` uses the red danger palette. `title` is optional, and the body continues to use Markdown.
404
+ `else` is the alternative branch. It must directly follow an `<if>` in the same container; comments and blank lines may separate them, but other content may not. An `<if>` accepts at most one `<else>`; nest another `<if>` inside a branch for more choices.
340
405
 
341
406
  ### accordion and disclosure
342
407
 
@@ -371,6 +436,10 @@ This is the jump target.
371
436
 
372
437
  `anchor` marks an explicit jump target. `id` is required and must be unique in the document. `jump` can also target an automatically generated heading anchor, such as `to="Details"` for `## Details`; repeated headings get suffixes, so an explicit `anchor` is easier to control. A missing target or duplicate ID is a compile error.
373
438
 
439
+ ### Reuse a group of controls with a macro
440
+
441
+ Enable macros with `<!-- reactive-md: local-draft-4 + macros -->`. Define a group with `<macro name="room" params="title" outputs="count">` and create an instance with `<use macro="room" title="West room" bind-count="west">`. Each call owns its control values. The output mapping makes the internal `count` available as `{{ west }}` in the rest of the document. Use the editor to complete the call or fold the definition. See the [interaction macro example](../reference/local-interaction-syntax-en.md#45-interaction-macros).
442
+
374
443
  ## 9. Other features
375
444
 
376
445
  ### color
@@ -387,6 +456,12 @@ Current attendees: **{{ people }}**. <text color="#a2273a">**Please confirm the
387
456
 
388
457
  Colors are static names or `#RGB` / `#RRGGBB` values. They do not accept expressions, CSS functions or variables.
389
458
 
459
+ `<text>` requires at least one of `color`, `size` or `font`. Omitted styles are inherited. Use `sm`, `md`, `lg` or `xl` for theme sizes, or a positive number in pixels. For example, `size="20"` sets 20px. Choose `sans`, `serif` or `mono` for `font`.
460
+
461
+ ```markdown
462
+ <text size="20">Registration closes today</text> · Ticket <text font="mono">REF-24</text>
463
+ ```
464
+
390
465
  ### badge
391
466
 
392
467
  ```markdown
@@ -407,6 +482,16 @@ At <tooltip text="8 or more people will trigger a venue capacity reminder.">8 pe
407
482
 
408
483
  `tooltip` is an inline explanation and requires `text`. Readers see it on pointer hover or keyboard focus. Use it for a short phrase or name.
409
484
 
485
+ ### alert
486
+
487
+ ```markdown
488
+ <alert tone="success" title="Group discount">
489
+ At 5 or more people, you can request group pricing.
490
+ </alert>
491
+ ```
492
+
493
+ `alert` is a callout block. `tone` accepts `info`, `success`, `warning` or `error` and defaults to `info`; `error` uses the red danger palette. `title` is optional, and the body continues to use Markdown.
494
+
410
495
  ## Common errors
411
496
 
412
497
  | Problem | Cause and fix |
@@ -417,6 +502,7 @@ At <tooltip text="8 or more people will trigger a venue capacity reminder.">8 pe
417
502
  | An `if` condition does not work | Use a complete boolean interpolation such as `when="{{ people >= 5 }}"`. |
418
503
  | A chart rejects a numeric cell | Write a plain number or a complete interpolation in the cell and move the unit to `y-label` or the header. |
419
504
  | An array is blank or raises an error | Do not write `{{ topics }}` directly. Use `len`, an index or an aggregate function such as `sum`. |
505
+ | A transform reports an error | Check that the source is a string or number array, the condition is boolean, and projections or keys are strings or numbers of one kind. |
420
506
  | Container content escapes | Check closing tags and nesting; containers must close explicitly. |
421
507
  | A tag or expression displays literally | Check whether it is inside code or escaped. Unknown tags produce fallback warnings. |
422
508
  | A table breaks at logical OR | Escape the pipe as `\|\|` inside a Markdown table cell. |
@@ -430,7 +516,7 @@ Use inline code or code fences to show literal tags and expressions. Write `\{{
430
516
 
431
517
  ## Complete component reference
432
518
 
433
- The following tables list all 49 tags in `local-draft-3`, grouped by purpose. The "Form" column shows how each tag is written: a no-body component has no closing tag, a container must close explicitly, an inline component can sit inside a sentence, a child tag belongs inside its parent, and a declaration does not render as interface content.
519
+ The following tables list all 52 tags in `local-draft-4`, grouped by purpose. The "Form" column shows how each tag is written: a no-body component has no closing tag, a container must close explicitly, an inline component can sit inside a sentence, a child tag belongs inside its parent, and a declaration does not render as interface content.
434
520
 
435
521
  Most interactive controls support `label`, optional `bind`, optional `initial` and dynamic `disabled`. The tables list the key attributes only. `number`/`slider` and `date` bounds and `required` may use one interpolation, such as `max="{{ rooms * 4 }}"`; narrowing a range keeps the current value and shows a field error instead of clamping it.
436
522
 
@@ -448,10 +534,10 @@ Most interactive controls support `label`, optional `bind`, optional `initial` a
448
534
  | `checkbox` | No body | `label`, `bind`, `initial`, `color` | Checkbox; boolean, default `false` |
449
535
  | `date` | No body | `label`, `bind`, `initial`, `min`, `max`, `required` (all three dynamic) | Date; value is `YYYY-MM-DD` or an empty string |
450
536
  | `counter` | No body | `label`, `bind`, `initial`, `min=0`, `max`, `step=1` | Number stepper; built-in decrease, increase and reset |
451
- | `select` | Container | `label`, `bind`, `initial`, `color`; child `option` | Dropdown single choice; first option by default |
452
- | `choices` | Container | `label`, `bind`, `initial`, `color`; child `option` | Option-card single choice |
453
- | `radio-group` | Container | `label`, `bind`, `initial`, `color`; child `option` | Radio button group |
454
- | `multi-select` | Container | `label`, `bind`, `initial`, `max-selected`, `color`; child `option` | Multiple choice; value is an array of strings |
537
+ | `select` | Container | `label`, `bind`, `initial`, `options`, `color`; child `option` | Dropdown single choice; first option by default |
538
+ | `choices` | Container | `label`, `bind`, `initial`, `options`, `color`; child `option` | Option-card single choice |
539
+ | `radio-group` | Container | `label`, `bind`, `initial`, `options`, `color`; child `option` | Radio button group |
540
+ | `multi-select` | Container | `label`, `bind`, `initial`, `options`, `max-selected`, `color`; child `option` | Multiple choice; value is an array of strings |
455
541
  | `option` | Child | `value` required; body is display text | Used by `select`, `choices`, `radio-group`, `multi-select` and `quiz` |
456
542
 
457
543
  ### Built-in actions and progress
@@ -469,19 +555,22 @@ Most interactive controls support `label`, optional `bind`, optional `initial` a
469
555
  | `panel` | Container | `title`, `reset=true` | Groups controls; resets their state |
470
556
  | `card` | Container | `title` | Content card; body uses Markdown |
471
557
  | `grid` | Container | `columns=2` (1–4) | Card grid; direct children must be `card` |
558
+ | `gallery` | Container | `label` required, `item-width=280` (180–480); child `gallery-item` | Horizontal strip with snapping and wheel, keyboard and thumb navigation |
559
+ | `gallery-item` | Child | `label` optional | One Markdown, image or card slide |
472
560
  | `tabs` | Container | `label`, `bind`, `initial`; child `tab` | Tabs; first tab by default |
473
561
  | `tab` | Child | `label` required, `value` optional | Tab child; `value` is generated in order when omitted |
474
562
  | `accordion` | Container | `label`; child `disclosure` | Accordion group |
475
563
  | `disclosure` | Child | `label` required, `open=false` | Expandable item; multiple items can be open at once |
476
564
  | `if` | Container | `when` required, complete boolean interpolation | Conditional display; hidden when the condition is false |
565
+ | `else` | Container | none | Alternative branch; must directly follow an `if` in the same container |
477
566
 
478
- ### Jumps and text color
567
+ ### Jumps and inline text styles
479
568
 
480
569
  | Tag | Form | Key attributes | Purpose |
481
570
  | --- | --- | --- | --- |
482
571
  | `jump` | Inline | `to` required, `appearance=link/button`, `color` | Scrolls to a heading anchor or explicit `anchor` |
483
572
  | `anchor` | No body | `id` required and unique in the document | Explicit jump target |
484
- | `text` | Inline | `color` required | Inline text color |
573
+ | `text` | Inline | At least one of `color`, `size` or `font` | Inline color, size and font |
485
574
  | `section` | Container | `color` required | Block text color; body continues to parse Markdown |
486
575
 
487
576
  ### Practice and steps
@@ -508,25 +597,25 @@ Most interactive controls support `label`, optional `bind`, optional `initial` a
508
597
  | `computed` | Declaration | `name`, `value` required | Top-level computed value; can read controls, constants and other computed values; not rendered |
509
598
  | `const` | Declaration | `name`, `value` required | Top-level constant; can read only constants and built-in constants; not rendered |
510
599
  | `validation` | Declaration | `when`, `message`, `fields` required | Cross-field validation; shows a message when it fails |
511
- | `data-table` | Container | `label`, `rows`, `key`, `max-rows=100`; child `column` | Generates table rows from a local array; `item` and `index` are available in each row |
512
- | `column` | Child | `label`, `value` required | A `data-table` column; cells output text only |
600
+ | `data-table` | Container | `label`, `rows`, `key`, `searchable=false`, `sortable=false`, `page-size`, `max-rows=100`, `align=center`, `row-align`, `empty`, `bind`, `initial`; child `column` | Generates table rows from a local array; `item` and `index` are available in each row; `row-align` sets body-row alignment; `empty` replaces the default placeholder when there are no rows |
601
+ | `column` | Child | `label`, `value` required; `format=plain`, `digits`, `currency`, `locale`, `summary`, `align` | A generated `data-table` or `chart` column; cells output text only; `summary=sum/average/count` and `align` apply to generated tables |
513
602
 
514
603
  ### Visualizations
515
604
 
516
605
  | Tag | Form | Key attributes | Purpose |
517
606
  | --- | --- | --- | --- |
518
607
  | `table` | Container | `label`, `searchable=true`, `sortable=true`, `page-size=10`, `key`, `bind`, `initial` | Enhanced table; body is a Markdown table |
519
- | `chart` | Container | `kind=bar`, `title`, `x`, `y`, `x-label`, `y-label`, `key`, `bind`, `initial` | Chart; body is a Markdown table |
608
+ | `chart` | Container | `kind=bar`, `title`, `rows`, `max-rows=100`, `x`, `y`, `x-label`, `y-label`, `key`, `bind`, `initial` | Chart; body is a Markdown table, or `column` children when `rows` is set |
520
609
  | `plot` | Container | `min=-10`, `max=10`, `samples=200`, `label`, `x-label`, `y-label` | Function curve; body is one or more `$$...$$` blocks |
521
610
  | `timeline` | Container | `title`, `unit="minutes"` | Timeline; body table uses `Task`, `Start`, `Duration`, with optional `Notes` |
522
611
  | `diagram` | Container | `label`, `bind`, `initial`, `direction=right/down`; children `node` and `edge` | Interactive diagram |
523
612
  | `node` | Child | `id` required and unique, `label` required, `tone` can be dynamic | Diagram node |
524
613
  | `edge` | Child | `from`, `to` required, `label` | Diagram edge |
525
614
 
526
- These 49 tags are the full set. `option`, `tab`, `disclosure`, `node`, `edge`, `step` and `column` are structural children; they must appear inside their matching parent and cannot be used alone.
615
+ These 52 tags are the full set. `option`, `tab`, `gallery-item`, `disclosure`, `node`, `edge`, `step` and `column` are structural children; they must appear inside their matching parent and cannot be used alone.
527
616
 
528
- `table` and `chart` require `key` together with `bind` or `initial`; `key` identifies the selected row. Each `$$...$$` block in a `plot` defines one explicit, parametric or implicit curve, with up to 16 curves per plot.
617
+ `table` and `chart` require `key` together with `bind` or `initial`; `key` identifies the selected row. `data-table` always requires `key`, and its `bind` exposes the selected row key. A chart with `rows` takes one or more `column` children instead of a Markdown table. Each `$$...$$` block in a `plot` defines one explicit, parametric or implicit curve, with up to 16 curves per plot.
529
618
 
530
- In addition, `<theme name="default">` before the body selects the document theme. It is document metadata and is not counted among the 49 tags.
619
+ In addition, `<theme name="default">` before the body selects the document theme. It is document metadata and is not counted among the 52 tags.
531
620
 
532
- Default mode also supports P0 HTML elements such as `div`, `span`, `p` and `h1` through `h6`. Among them, `div`, `p` and `h1` through `h6` accept a static `align` value (`left`, `center`, `right` or `justify`). These are HTML elements, not part of the 49 tags above.
621
+ Default mode also supports P0 HTML elements such as `div`, `span`, `p` and `h1` through `h6`. Among them, `div`, `p` and `h1` through `h6` accept a static `align` value (`left`, `center`, `right` or `justify`). These are HTML elements, not part of the 52 tags above.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **中文** · [English](author-tools-en.md)
4
4
 
5
- 安装 `reactive-md@0.9.3` 即可使用 CLI 和不依赖 React 的 `reactive-md/authoring` 入口。从本仓库开发时,先构建语言包:
5
+ 安装 `reactive-md@0.10.0` 即可使用 CLI 和不依赖 React 的 `reactive-md/authoring` 入口。从本仓库开发时,先构建语言包:
6
6
 
7
7
  ```sh
8
8
  npm ci
@@ -2,7 +2,7 @@
2
2
 
3
3
  **English** · [中文](author-tools-ch.md)
4
4
 
5
- Install `reactive-md@0.9.3` to use the CLI and the React-free `reactive-md/authoring` entry. To work from this repository, build the package first:
5
+ Install `reactive-md@0.10.0` to use the CLI and the React-free `reactive-md/authoring` entry. To work from this repository, build the package first:
6
6
 
7
7
  ```sh
8
8
  npm ci
@@ -2,7 +2,7 @@
2
2
 
3
3
  **中文** · [English](editor-en.md)
4
4
 
5
- `reactive-md-editor@0.2.1` 要求 `reactive-md@^0.9.2` 引擎 peer。编辑器自 `reactive-md@0.8.0` / 编辑器 `0.1.0` 起独立为单独的包。编辑器基于 CodeMirror 6,事务、共享分析和源码坐标约定见下文。
5
+ `reactive-md-editor@0.3.0` 要求 `reactive-md@^0.10.0` 引擎 peer。编辑器自 `reactive-md@0.8.0` / 编辑器 `0.1.0` 起独立为单独的包。编辑器基于 CodeMirror 6,事务、共享分析和源码坐标约定见下文。
6
6
 
7
7
  `reactive-md-editor` 是用于 Reactive MD 源码的受控 React 19 编辑器,由 Playground 编辑器抽出。它提供源码高亮、格式与插入工具栏、补全、绑定导航、重命名与格式化、撤销重做、行号及滚动同步。编辑器内置字数底栏及编辑、并排、预览三种视图。宿主保存源码,并提供预览内容、持久化和导出。
8
8
 
@@ -13,11 +13,11 @@
13
13
  ## 安装
14
14
 
15
15
  ```sh
16
- npm install reactive-md@0.9.3 reactive-md-editor@0.2.1
16
+ npm install reactive-md@0.10.0 reactive-md-editor@0.3.0
17
17
  npm install react@19 react-dom@19
18
18
  ```
19
19
 
20
- 两个正式版本均已发布;只有测试尚未发布的候选版本时,才需要安装从当前源码打包的 tarball。包只提供 ESM,工具和服务端渲染需要 Node.js 22.12 或更新版本。
20
+ 两个正式版本均已发布。`reactive-md-editor@0.3.0` 声明 `reactive-md@^0.10.0`,请将两者一起安装。`reactive-md-editor@0.2.1` 继续面向 `0.9.x` 引擎系列:其 `^0.9.2` peer 不接受 `0.10.0`,因此跨 `0.10` 升级引擎的宿主必须同时升级编辑器。只有测试尚未发布的候选版本时,才需要安装从当前源码打包的 tarball。包只提供 ESM,工具和服务端渲染需要 Node.js 22.12 或更新版本。
21
21
 
22
22
  ## 最小受控编辑器
23
23
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **English** · [中文](editor-ch.md)
4
4
 
5
- `reactive-md-editor@0.2.1` requires the `reactive-md@^0.9.2` engine peer. The editor has been a separate package since `reactive-md@0.8.0` / editor `0.1.0`. The CM6 transaction, shared analysis and source-coordinate contract is described below.
5
+ `reactive-md-editor@0.3.0` requires the `reactive-md@^0.10.0` engine peer. The editor has been a separate package since `reactive-md@0.8.0` / editor `0.1.0`. The CM6 transaction, shared analysis and source-coordinate contract is described below.
6
6
 
7
7
  `reactive-md-editor` is a controlled React 19 editor for Reactive MD source. It comes from the Playground editor and provides source highlighting, a formatting and insertion toolbar, completion, binding navigation, rename and format commands, undo and redo, line numbers and scroll synchronization. Its built-in status bar provides a character count and Edit, Split and Preview views. The host keeps the source text and supplies preview content, persistence and export.
8
8
 
@@ -13,11 +13,11 @@ Replace the old `reactive-md/editor` subpaths and styles with the independent pa
13
13
  ## Install
14
14
 
15
15
  ```sh
16
- npm install reactive-md@0.9.3 reactive-md-editor@0.2.1
16
+ npm install reactive-md@0.10.0 reactive-md-editor@0.3.0
17
17
  npm install react@19 react-dom@19
18
18
  ```
19
19
 
20
- Both releases are published. A tarball built from the current source is only needed for an unreleased candidate. The packages ship ESM only and need Node.js 22.12 or newer for tooling and server rendering.
20
+ Both releases are published. `reactive-md-editor@0.3.0` declares `reactive-md@^0.10.0`, so install the two together. `reactive-md-editor@0.2.1` remains on the `0.9.x` engine series: its `^0.9.2` peer does not accept `0.10.0`, so hosts upgrading the engine across `0.10` must upgrade the editor too. A tarball built from the current source is only needed for an unreleased candidate. The packages ship ESM only and need Node.js 22.12 or newer for tooling and server rendering.
21
21
 
22
22
  ## Minimal controlled editor
23
23
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  **中文** · [English](extension-sdk-en.md)
4
4
 
5
- 扩展 SDK 自 `reactive-md@0.8.0` 起提供,覆盖公开扩展与默认组件统一;`0.9.3` 保持同一 `0.7.0` 契约。安装当前公开包即可;只有测试尚未发布的改动时才需要从源码打包 tarball。
5
+ 扩展 SDK 自 `reactive-md@0.8.0` 起提供,覆盖公开扩展与默认组件统一;`0.10.0` 保持同一 `0.7.0` 契约。安装当前公开包即可;只有测试尚未发布的改动时才需要从源码打包 tarball。
6
6
 
7
7
  ```sh
8
- npm install reactive-md@0.9.3
8
+ npm install reactive-md@0.10.0
9
9
  ```
10
10
 
11
11
  registry 包包含 `reactive-md/build`、`reactive-md/testing` 和第三阶段的其他入口。仓库内消费检查在源码树之外安装公开包,因此公开导入面按发布形态接受检查,而不是依赖源码别名。SDK 版本范围写 `^0.7.0`。
@@ -46,7 +46,7 @@ export function Reader({ source }: { source: string }) {
46
46
  }
47
47
  ```
48
48
 
49
- 默认预设保持启用。宿主也可从 `reactive-md/presets/default` 显式导入 `defaultPreset` 并传入 `presets: [defaultPreset]`。预设包含 48 个经过公开契约校验的组件;新增组件与默认组件共用编译和渲染机制。注册时拒绝同名覆盖。
49
+ 默认预设保持启用。宿主也可从 `reactive-md/presets/default` 显式导入 `defaultPreset` 并传入 `presets: [defaultPreset]`。预设包含 49 个经过公开契约校验的组件;新增组件与默认组件共用编译和渲染机制。注册时拒绝同名覆盖。
50
50
 
51
51
  配置创建时检查重复名称与 id、保留名称、协议、依赖和预算,并复制、冻结数据。`readLocalConfig` 对 Worker 或导出载荷中的配置重新校验,重新计算语义摘要。React 实现的 manifest 摘要必须与配置匹配。组件集合变化时创建新配置。
52
52
 
@@ -98,6 +98,8 @@ const result = ctx.bindings.setMany({ x: 2, y: 3 });
98
98
 
99
99
  `structure` 声明直接子项、父层要求和内容形态;`rules` 声明可复用的编译或状态规则。规则可描述数值区间、日期、选项序列、表格、图形、导航和预算。内核执行规则,组件实现负责交互。外部组件可以复用默认定义的规则,或组合公开类型声明的原语。
100
100
 
101
+ 规则 `{ kind: 'required-one-of', attributes: ['color', 'size'] }` 要求源码至少填写列出的一项属性。枚举属性设置 `allowPositiveNumber: true` 后,也接受有限正数,组块收到的值为字符串。编辑器会补全声明的枚举值。
102
+
101
103
  `structure: { rule: 'raw-body' }` 声明正文以单个惰性 `rawBody` 子节点交付的容器,不按 Markdown 解析。正文内的组块标签、`{{ }}`、实体、转义和 Markdown 都保持原文。正文只在一行的第一个非空白内容恰好为 `</name>` 时结束;交付值是去缩进后的源码,`limits.maxRawBodyChars` 限制其长度(默认 100,000,最多 1,000,000)。正文必填(`min > 0`)且为空白时使用既有 children minimum 诊断。渲染时把值当作文本:`ctx.children.render()` 输出一个转义后的文本节点;宿主若自行把字符串写入 HTML,由宿主负责转义。analyzer 把正文视为不透明区间。详见[组块协议](../development/component-protocol-ch.md#cp-model-05-raw-正文容器要求)。
102
104
 
103
105
  React 上下文的 `content` 与 `children.items()` 提供公开内容投影。组件通过 `children.render()`、`children.options()`、`children.table()` 等方法消费子内容,通过 `validation`、`navigation`、`source` 和 `locale` 使用通用服务。运行时服务提供求值、状态读写与重置;内部 AST 保留在适配器中。
@@ -170,6 +172,8 @@ export const notices = [
170
172
 
171
173
  `root` 是适配器唯一读取的目录。每个 `allowlist` 目录都必须在 `root` 内,资源文件必须同时位于两者之内,入口模块也必须在 `root` 内。`resources`(或 `styles`)可选;`notices` 接受记录数组或字符串。构建调用中的同名 `resources` 与 `notices` 选项会和宿主导出的声明合并。相同声明去重;内容冲突产生诊断。
172
174
 
175
+ 入口模块同时会打进浏览器 bundle,因此它的顶层代码必须保持浏览器安全。构建会拒绝任何 Node 内置模块导入(`node:path`、`node:url`、`fs`、`node:crypto` 等),报 `local.build.host-browser` 并指出模块名与导入方。构建专用路径请在生成 host 模块的脚本里算好,或按文档用 `new URL('.', import.meta.url)` 表示 `root`。
176
+
173
177
  ### 预检与构建
174
178
 
175
179
  ```ts
@@ -225,6 +229,28 @@ Vite 输出必须恰好是一个 chunk,且没有 asset。适配器拒绝带 im
225
229
 
226
230
  Vite 8 是可选 peer 依赖。适配器只在真正执行构建时导入 `vite`,仅做预检或读取 manifest 的消费者无需安装。测试或非标准宿主可以把 `vite` 作为 `{ build }` facade 或其工厂传入;注入值会先经过检查。
227
231
 
232
+ ### 宿主字体与主题字体
233
+
234
+ 通过 `createReactHost({ fonts })` 注册源码可用的字体别名。编辑器传入同一宿主的 `compileOptions`,渲染器传入 `reactConfig`。在 Vite 宿主入口中,`defineLocalFont` 接收 WOFF 或 WOFF2 文件的内联 data URL,返回别名表和样式资源。
235
+
236
+ ```ts
237
+ import { defineLocalFont } from 'reactive-md/sdk';
238
+ import { createReactHost } from 'reactive-md/react';
239
+ import brandSource from './Brand.woff2?inline';
240
+
241
+ const brand = defineLocalFont({ alias: 'brand', source: brandSource });
242
+ export const host = createReactHost({
243
+ fonts: brand.fonts,
244
+ resources: [brand.resource],
245
+ });
246
+ ```
247
+
248
+ 作者可以写 `<text font="brand" size="20">报名截止</text>`。手工集成 React 时加载 `host.css`,导出时传入 `host.resources`。Vite 插件会安装宿主样式,并为离线包收集资源。
249
+
250
+ 主题可以通过 `defineLocalTheme` 的 `fonts` 选项注册别名,目录模式也可在 `theme.json` 中填写 `fonts`。例如,把 `display` 映射到 `Paper Display`,并在主题的 `@font-face` 中声明该字体族。目录加载器会内联相对路径字体文件,SDK 会同步改写别名指向的字体族名称。
251
+
252
+ 宿主和主题注册同名别名时,使用当前主题的字体。别名使用小写字母、数字和连字符。`sans`、`serif`、`mono` 仍对应主题的字体变量。Vite 目录模式可通过 `reactiveMd({ fonts: { display: 'Georgia' } })` 注册宿主级别名。
253
+
228
254
  ## 离线导出与 bundle seal
229
255
 
230
256
  `defineLocalStandaloneBundle(script, config)` 把宿主预先构建的可信脚本与已安装 manifest 集合绑定。seal 使用协议 `reactive-md-bundle/v1`,记录 SDK 版本、配置摘要、脚本摘要和每个主题的契约摘要。
@@ -2,10 +2,10 @@
2
2
 
3
3
  **English** · [中文](extension-sdk-ch.md)
4
4
 
5
- The extension SDK has shipped since `reactive-md@0.8.0` for public extensions and unified default components; `0.9.3` keeps it at the same `0.7.0` contract. Install the current published package; use a source-built tarball only when testing unreleased changes.
5
+ The extension SDK has shipped since `reactive-md@0.8.0` for public extensions and unified default components; `0.10.0` keeps it at the same `0.7.0` contract. Install the current published package; use a source-built tarball only when testing unreleased changes.
6
6
 
7
7
  ```sh
8
- npm install reactive-md@0.9.3
8
+ npm install reactive-md@0.10.0
9
9
  ```
10
10
 
11
11
  The registry package contains `reactive-md/build`, `reactive-md/testing` and the other phase-three entries. The consumer checks install the published package outside the repository, so the public import surface is exercised as published rather than through source aliases. SDK version ranges name `^0.7.0`.
@@ -44,7 +44,7 @@ export function Reader({ source }: { source: string }) {
44
44
  }
45
45
  ```
46
46
 
47
- The default preset remains enabled. `reactive-md/presets/default` exports `defaultPreset` for explicit configuration. Its 48 components pass the public validator and share compilation and rendering with external components. Registration rejects name overrides.
47
+ The default preset remains enabled. `reactive-md/presets/default` exports `defaultPreset` for explicit configuration. Its 49 components pass the public validator and share compilation and rendering with external components. Registration rejects name overrides.
48
48
 
49
49
  Registration validates identities, names, protocol, dependencies and budgets, then copies and freezes the data. `readLocalConfig` revalidates serialized configuration and recomputes its semantic key. React implementations must match their registered manifests.
50
50
 
@@ -84,6 +84,8 @@ Use `family: 'collection'` with `kind: 'array'` or `'number-array'` for general
84
84
 
85
85
  `structure` describes direct children, placement and content shape. `rules` declares reusable compile or state semantics for numeric ranges, dates, option sequences, tables, diagrams, navigation and budgets. External components may reuse default contracts or compose the primitives described by the public types.
86
86
 
87
+ The rule `{ kind: 'required-one-of', attributes: ['color', 'size'] }` requires at least one listed attribute to appear in the source. An enum prop with `allowPositiveNumber: true` also accepts finite positive numeric literals and delivers them to the component as strings. The editor suggests the declared enum values.
88
+
87
89
  `structure: { rule: 'raw-body' }` declares a container whose body is delivered as one lazy `rawBody` child instead of Markdown. Nothing inside is parsed: component tags, `{{ }}`, entities, escapes and Markdown stay literal. The body closes only on a line whose first non-whitespace content is exactly `</name>`; the delivered value is the dedented source and `limits.maxRawBodyChars` bounds it (default 100,000; at most 1,000,000). A required body (`min > 0`) reports the existing children-minimum diagnostic when blank. Render the value as text: `ctx.children.render()` emits one escaped text node, and a host that inserts the string into its own HTML must escape it. Analysis treats the body as opaque. See CP-MODEL-05 in the [component protocol](../development/component-protocol-en.md#cp-model-05-raw-body-containers-required).
88
90
 
89
91
  The React context exposes public content projections through `content` and `children.items()`. Use `children.render()`, `children.options()` and `children.table()` for child content, plus `validation`, `navigation`, `source` and `locale` for shared services. Runtime services expose evaluation, state writes and resets. The adapter owns internal AST access.
@@ -156,6 +158,8 @@ export const notices = [
156
158
 
157
159
  `root` is the only directory the adapter reads from. Every `allowlist` directory must be inside `root`, and every resource file must resolve inside both. The entry module must also be inside `root`. `resources` (or `styles`) is optional; `notices` accepts an array of records or a string. The same `resources` and `notices` options passed to the build call are merged with host exports. Identical declarations deduplicate; conflicting contents produce a diagnostic.
158
160
 
161
+ The entry module is also bundled for the browser, so its top-level code must stay browser-safe. Builds reject any Node built-in import (`node:path`, `node:url`, `fs`, `node:crypto`, ...) with `local.build.host-browser`; the rejection names the specifier and importer. Compute build-only values in the script that writes the host module, or use the documented `new URL('.', import.meta.url)` form for `root`.
162
+
159
163
  ### Preflight and build
160
164
 
161
165
  ```ts
@@ -211,6 +215,28 @@ Default budgets are 128 resources, 4 MiB of CSS, 8 MiB per file, 24 MiB of inlin
211
215
 
212
216
  Vite 8 is an optional peer dependency. The adapter imports `vite` only when a build actually runs, so consumers that only preflight or read manifests do not install it. For tests or nonstandard hosts, pass `vite` as a `{ build }` facade or a factory returning one. The injected facade is checked before use.
213
217
 
218
+ ### Fonts for the host and selected theme
219
+
220
+ Register source aliases in `createReactHost({ fonts })`. Use the same host's `compileOptions` in the editor and `reactConfig` in the renderer. In a Vite host entry, `defineLocalFont` takes the inline data URL of a WOFF or WOFF2 file and returns an alias map and a stylesheet resource.
221
+
222
+ ```ts
223
+ import { defineLocalFont } from 'reactive-md/sdk';
224
+ import { createReactHost } from 'reactive-md/react';
225
+ import brandSource from './Brand.woff2?inline';
226
+
227
+ const brand = defineLocalFont({ alias: 'brand', source: brandSource });
228
+ export const host = createReactHost({
229
+ fonts: brand.fonts,
230
+ resources: [brand.resource],
231
+ });
232
+ ```
233
+
234
+ Authors use `<text font="brand" size="20">Heading</text>`. Load `host.css` in a manual React integration and pass `host.resources` to export. The Vite plugin installs the host stylesheet and collects resources for the standalone bundle.
235
+
236
+ A theme can add aliases through the `fonts` option of `defineLocalTheme` or the `fonts` field of `theme.json` in directory mode. For example, map `display` to `Paper Display` and declare that family in the theme's `@font-face`. The directory loader inlines relative font files, and the SDK rewrites the alias to the scoped family name.
237
+
238
+ The selected theme wins when it and the host register the same alias. Use lowercase kebab-case aliases. The names `sans`, `serif` and `mono` refer to the theme's font tokens. Directory-mode Vite hosts can also register host-wide aliases with `reactiveMd({ fonts: { display: 'Georgia' } })`.
239
+
214
240
  ## Offline export and the bundle seal
215
241
 
216
242
  `defineLocalStandaloneBundle(script, config)` binds a trusted host-built script to the installed manifest set. The seal uses protocol `reactive-md-bundle/v1` and records the SDK version, configuration key, script digest and every theme contract digest.
@@ -327,7 +327,7 @@ if (result.ok) {
327
327
  - 成功:`{ ok: true; document: LocalDocument; diagnostics: Diagnostic[] }`
328
328
  - 失败:`{ ok: false; diagnostics: Diagnostic[] }`
329
329
 
330
- 语法问题通过诊断返回;当前构建只接受 `local-draft-3`。显式旧修订指令会以 `local.version.*` 诊断拒绝;无指令源码保持当前修订的行为。源码上限为 1,000,000 字符。`document` 是当前运行时对象,不应当作持久化格式。
330
+ 语法问题通过诊断返回;当前构建只接受 `local-draft-4`。显式旧修订指令会以 `local.version.*` 诊断拒绝;无指令源码保持当前修订的行为。源码上限为 1,000,000 字符。`document` 是当前运行时对象,不应当作持久化格式。
331
331
 
332
332
  宿主可以为单次编译设置语法节点预算:
333
333
 
@@ -410,7 +410,7 @@ const migrated = migrateLocalSource(source, { fromVersion: 'local-draft-1' });
410
410
 
411
411
  `inspectLocalSourceVersion` 返回声明修订、用于判定的修订、当前编译器是否支持、指令位置和版本诊断。`checkLocalUpgrade` 返回 `ok`、`fromVersion`、`toVersion`、`needsMigration` 和诊断。`migrateLocalSource` 在此基础上增加 `source`、`changed` 和准确的 `edits`。
412
412
 
413
- `LocalUpgradeOptions` 提供 `fromVersion` 和 `allowSemanticChanges`。无版本声明的历史文档需要 `fromVersion: 'local-draft-1'`。显式 `fromVersion` 与声明不一致时被拒绝。迁移源接受 `local-draft-1`、`local-draft-2` 和 `local-draft-3`。
413
+ `LocalUpgradeOptions` 提供 `fromVersion` 和 `allowSemanticChanges`。无版本声明的历史文档需要匹配的 `fromVersion: 'local-draft-1'`、`'local-draft-2'` 或 `'local-draft-3'`。显式 `fromVersion` 与声明不一致时被拒绝。迁移源接受 `local-draft-1` 至 `local-draft-3` 以及当前的 `local-draft-4`。
414
414
 
415
415
  迁移只改元数据指令,保留正文原始字节、BOM 和 CRLF,并且幂等。生成结果前会阻止保留绑定、新增可识别标签、编译错误和文本控件长度语义变化。完整检查与 CLI 见[源码修订与迁移](../compatibility/source-versioning-ch.md)。
416
416
 
@@ -550,7 +550,7 @@ scheduler.schedule(source);
550
550
 
551
551
  ### 其他核心导出
552
552
 
553
- - `LOCAL_SYNTAX_VERSION`:当前为字面量 `'local-draft-3'`。用它记录文档所用的语法修订。
553
+ - `LOCAL_SYNTAX_VERSION`:当前为字面量 `'local-draft-4'`。用它记录文档所用的语法修订。
554
554
  - `compileExpression(source: string)`:返回带 `source`、`dependencies`、`evaluate(env)` 和 `inferType(env)` 的对象;失败抛出 `LocalExpressionError`。
555
555
  - `LocalExpressionError`:包含 `code` 和 `offset`。
556
556
  - `compileLatex(source: string)`:返回带 `source`、`dependencies` 和 `evaluate(x, env, budget?)` 的对象;失败抛出带 `code`、`offset` 的错误。
@@ -323,7 +323,7 @@ if (result.ok) {
323
323
  - Success: `{ ok: true; document: LocalDocument; diagnostics: Diagnostic[] }`
324
324
  - Failure: `{ ok: false; diagnostics: Diagnostic[] }`
325
325
 
326
- Syntax problems are returned through diagnostics; the current build accepts only `local-draft-3`. An explicit older revision directive is rejected with a `local.version.*` diagnostic; an unversioned source keeps current-revision behavior. The source limit is 1,000,000 characters. `document` is a current runtime object and should not be treated as a persistence format.
326
+ Syntax problems are returned through diagnostics; the current build accepts only `local-draft-4`. An explicit older revision directive is rejected with a `local.version.*` diagnostic; an unversioned source keeps current-revision behavior. The source limit is 1,000,000 characters. `document` is a current runtime object and should not be treated as a persistence format.
327
327
 
328
328
  Hosts can set the syntax node budget for a single compilation:
329
329
 
@@ -425,7 +425,7 @@ const migrated = migrateLocalSource(source, { fromVersion: 'local-draft-1' });
425
425
 
426
426
  `inspectLocalSourceVersion` reports the declared and effective revision, whether this compiler supports it, the directive range and version diagnostics. `checkLocalUpgrade` reports `ok`, `fromVersion`, `toVersion`, `needsMigration` and diagnostics. `migrateLocalSource` adds `source`, `changed` and precise `edits`.
427
427
 
428
- `LocalUpgradeOptions` supplies `fromVersion` and `allowSemanticChanges`. An unversioned historical document needs `fromVersion: 'local-draft-1'`. An explicit `fromVersion` that disagrees with the declaration is rejected. `local-draft-1`, `local-draft-2` and `local-draft-3` are accepted migration sources.
428
+ `LocalUpgradeOptions` supplies `fromVersion` and `allowSemanticChanges`. An unversioned historical document needs the matching `fromVersion: 'local-draft-1'`, `'local-draft-2'` or `'local-draft-3'`. An explicit `fromVersion` that disagrees with the declaration is rejected. `local-draft-1` through `local-draft-3` and the current `local-draft-4` are accepted migration sources.
429
429
 
430
430
  Migration changes only the metadata directive, preserves body bytes, BOM and CRLF, and is idempotent. It blocks reserved bindings, newly recognized tags, compile errors and text-control length changes before producing output. See [Source revisions and migration](../compatibility/source-versioning-en.md) for the exact checks and the CLI.
431
431
 
@@ -565,7 +565,7 @@ scheduler.schedule(source);
565
565
 
566
566
  ### Other core exports
567
567
 
568
- - `LOCAL_SYNTAX_VERSION`: currently the literal `'local-draft-3'`. Use it to record the syntax revision a document uses.
568
+ - `LOCAL_SYNTAX_VERSION`: currently the literal `'local-draft-4'`. Use it to record the syntax revision a document uses.
569
569
  - `compileExpression(source: string)`: returns an object with `source`, `dependencies`, `evaluate(env)` and `inferType(env)`; throws `LocalExpressionError` on failure.
570
570
  - `LocalExpressionError`: contains `code` and `offset`.
571
571
  - `compileLatex(source: string)`: returns an object with `source`, `dependencies` and `evaluate(x, env, budget?)`; throws an error with `code` and `offset` on failure.
@@ -0,0 +1,42 @@
1
+ # PDF 导出(预览)
2
+
3
+ **中文** · [English](pdf-export-en.md)
4
+
5
+ **预览。** PDF 导出目前是预览功能。版式、分页与打印诊断仍有缺陷,行为可能随版本调整。
6
+
7
+ 静态 PDF(`--format pdf`)使用 Chromium 将静态 HTML 排版为分页文档。它与 HTML 导出共用 React 渲染,使用所选状态计算条件内容、插值、表格、公式和图表。
8
+
9
+ ## 环境要求
10
+
11
+ PDF 导出按需加载 `reactive-md/pdf`。在执行构建的项目中安装可选打印引擎:
12
+
13
+ ```sh
14
+ npm install playwright
15
+ npx playwright install chromium
16
+ ```
17
+
18
+ HTML 构建、`lint` 和 `migrate` 不需要 Playwright。
19
+
20
+ ## CLI
21
+
22
+ ```sh
23
+ reactive-md build doc.reactive.md -o doc.pdf --format pdf
24
+ reactive-md build doc.reactive.md -o doc.pdf --format pdf --pdf-margin 12mm
25
+ reactive-md build doc.reactive.md -o doc.pdf --format pdf --pdf-paper Letter --pdf-landscape --pdf-background off
26
+ ```
27
+
28
+ PDF 构建使用静态模式。`--pdf-paper`、`--pdf-landscape`、`--pdf-margin` 和 `--pdf-background` 控制页面。`--state-file`、`--assets`、`--asset-root`、`--locale`、`--color-scheme`、`--title`、`--strict` 和 `--project-root` 与 HTML 构建一致。公共选项与退出码见[分享与静态导出](shareable-export-ch.md)。
29
+
30
+ `--pdf-margin` 覆盖打印样式表中的页边距。Chromium 无法解码图片时,CLI 会发出警告;加上 `--strict` 会终止导出。警告代码为 `local.pdf.image-decode`。
31
+
32
+ ## Node API
33
+
34
+ `reactive-md/pdf` 的 `renderLocalPdf(html, options)` 接收准备好的静态 HTML,返回 PDF 字节。选项包括 `format`、`landscape`、`margin`、`printBackground`、`strict` 和 `onDiagnostic`。入口见[公开接口参考](../reference/public-api-ch.md#reactive-mdpdf)。
35
+
36
+ HTML 由 `renderLocalStaticDocument` 与 `createShareableHtml` 生成,流程见[分享与静态导出](shareable-export-ch.md)。
37
+
38
+ ## 预览范围
39
+
40
+ - 版式与分页遵循 Chromium 打印引擎,包括其 CSS 打印限制。
41
+ - 打印诊断目前覆盖图片解码(`local.pdf.image-decode`)。版式问题不会产生诊断,直接输出。
42
+ - PDF 使用静态渲染。文档脚本不执行;未通过静态能力检查的扩展会被拒绝。