rapier-markdown-kit 1.1.54 → 1.1.56

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/README.md CHANGED
@@ -26,6 +26,47 @@ import {parseWill} from 'rapier-markdown-kit/will'; // Will/1 markers: kee
26
26
  import {parseAssets} from 'rapier-markdown-kit/assets'; // the picture appendix
27
27
  ```
28
28
 
29
+ ## The shared renderer
30
+
31
+ `rapier-markdown-kit/render` exports `createRenderer`, `createMarkdownRenderer`,
32
+ `createRenderStyles`, `createRenderSanitizer` and `createPrintRenderer`. These are the
33
+ actual editor/Share owners, not a second Markdown dialect or a lookalike stylesheet.
34
+ Their host dependencies are explicit named properties in each factory's first argument;
35
+ no factory reaches into an editor session to find its document. `style.css` is the exact
36
+ MIT `spec/markdown-style.css`, including the numbered-list, checkbox, callout, table,
37
+ footnote and picture-layout treatment.
38
+
39
+ ```js
40
+ import {createRenderer} from 'rapier-markdown-kit/render';
41
+
42
+ // host is your bound DOM/codec/Markdown/image/style environment. Its named ports are
43
+ // declared at the top of createRenderer; preparation returns a detached semantic root.
44
+ const writer = createRenderer(host);
45
+ const {html, filename} = await writer.render(source, {filename: 'proposal.md'});
46
+ ```
47
+
48
+ `createMarkdownRenderer(host).render(source, metadata)` returns the semantic HTML.
49
+ The page writer's `render` returns `{html, filename}` asynchronously and preserves the
50
+ original source, including BOM and line endings, in the SHA-256-verified source carrier.
51
+ Every existing lower-level method is also returned for hosts that compose the stages.
52
+ Create a new bound instance when its parser or host state changes; do not share mutable
53
+ DOM objects between document realms.
54
+
55
+ This is a **DOM-hosted library**, not a bundled headless browser, DOM shim, parser or
56
+ image decoder. Supplying only `{source}` or running it in bare Node without those ports
57
+ is not supported. A host must provide a real DOM and sanitizer, the Rapier grammar,
58
+ portable image preparation, style access and the named codec/layout ports it uses.
59
+ Those dependencies keep their own licences: the MIT grant here does not relicense a
60
+ separately supplied host or vendor. The repository's `editor/render-host.js` binds the
61
+ editor; `server/` provides a complete local host with a pinned Chromium process. Its
62
+ Word exporter and filesystem service are AGPL, not part of this MIT package.
63
+
64
+ The extraction receipt in the existing `html-export-corpus` row fixes all 226 baseline
65
+ writer pages byte for byte. That corpus supplies a clean DOM and named style/sanitizer
66
+ adapters: it proves serialization and source recovery, not browser appearance or
67
+ sanitizer security. The server's integration cells additionally use a real DOM and
68
+ round-trip the actual HTTP output.
69
+
29
70
  ## What it gives you
30
71
 
31
72
  | Import | What it is |
@@ -4,3 +4,4 @@ export * from './marks.mjs';
4
4
  export * from './model.mjs';
5
5
  export * from './will.mjs';
6
6
  export * from './assets.mjs';
7
+ export * from './render-entry.mjs';
@@ -0,0 +1,7 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // The public renderer door; each factory binds explicit host ports once per document realm.
3
+ export {createRenderer} from './render.mjs';
4
+ export {createMarkdownRenderer} from './render-markdown.mjs';
5
+ export {createRenderStyles} from './render-styles.mjs';
6
+ export {createRenderSanitizer} from './render-sanitize.mjs';
7
+ export {createPrintRenderer} from './render-print.mjs';