chiltepin-render 0.33.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.
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/index.d.ts +510 -0
- package/dist/index.js +16751 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chiltepin contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# chiltepin-render
|
|
2
|
+
|
|
3
|
+
`renderDocument(doc) → string`. Pure function: takes a parsed `chiltepin-core` Document, returns a standalone HTML string with inlined CSS and inline SVG diagrams. No browser, no DOM, no I/O.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pnpm add chiltepin-render chiltepin-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { parseDocument } from 'chiltepin-core';
|
|
15
|
+
import { renderDocument } from 'chiltepin-render';
|
|
16
|
+
|
|
17
|
+
const html = renderDocument(parseDocument(markdown, 'orders'));
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Exports
|
|
21
|
+
|
|
22
|
+
- **`renderDocument(doc)`** — full standalone HTML page (`<!doctype html>…`).
|
|
23
|
+
- **`houseCss`** — the house stylesheet as a string. Useful if you want to render into a fragment and inject CSS elsewhere.
|
|
24
|
+
- **`htmlRenderers`** — `Record<BlockType, (data) => string>`. Per-block renderer registry; typed so omitting a block type is a compile error.
|
|
25
|
+
- **`renderProse(text)`** — Markdown prose → HTML wrapped in `.prose`.
|
|
26
|
+
- **`escapeHtml(value)`** — entity-escape `&<>"`.
|
|
27
|
+
|
|
28
|
+
## Fidelity
|
|
29
|
+
|
|
30
|
+
CSS is ported verbatim from the reference renderer at `resources/chiltepin-renderer.html`. Block DOM signatures match the reference's class names and element structure. SVG geometry uses integer-only coordinates, so output is byte-deterministic.
|