@orkestrel/markdown 0.0.13 → 0.0.15
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 +12 -6
- package/dist/src/core/index.cjs +124 -117
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +247 -218
- package/dist/src/core/index.d.ts +247 -218
- package/dist/src/core/index.js +124 -117
- package/dist/src/core/index.js.map +1 -1
- package/package.json +14 -15
package/README.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# @orkestrel/markdown
|
|
2
2
|
|
|
3
|
-
A types-first markdown layer over `@orkestrel/html`:
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
> A types-first markdown layer over `@orkestrel/html`: a linear-time scanner that parses
|
|
4
|
+
> GitHub-Flavored Markdown into a typed AST, a stateful `Markdown` workspace that queries,
|
|
5
|
+
> rewrites, folds, and streams that AST, and standalone projections that carry it out to
|
|
6
|
+
> sanitized HTML or canonical markdown source and carry an HTML AST back in.
|
|
7
|
+
|
|
8
|
+
Parse a document with the `createMarkdown` function, query and rewrite the AST the handle holds,
|
|
9
|
+
then write it back out with the `renderHTML` or `renderMarkdown` function. Where the source is
|
|
10
|
+
HTML instead, the `htmlToMarkdown` function brings it the other way. Part of the `@orkestrel`
|
|
11
|
+
line.
|
|
6
12
|
|
|
7
13
|
- **One AST, several projections.** Nodes are plain readonly data keyed by `element`; parsing,
|
|
8
14
|
querying, rewriting, folding, streaming, and every conversion are operations over it.
|
|
9
|
-
- **
|
|
15
|
+
- **Each direction lives here.** `markdownToHTML` and `htmlToMarkdown` are inverse projections
|
|
10
16
|
across the boundary, because what an HTML subtree means in markdown is markdown's knowledge, not
|
|
11
17
|
html's.
|
|
12
18
|
- **Sanitized by default, with no opt-out.** `renderHTML` takes one argument and composes
|
|
@@ -24,7 +30,7 @@ npm install @orkestrel/markdown
|
|
|
24
30
|
|
|
25
31
|
- Node.js >= 22.12
|
|
26
32
|
- Ships ES and CommonJS builds with its own `.d.ts` types
|
|
27
|
-
-
|
|
33
|
+
- Depends at runtime on `@orkestrel/html` and `@orkestrel/contract`
|
|
28
34
|
|
|
29
35
|
## Usage
|
|
30
36
|
|
|
@@ -63,7 +69,7 @@ bundle of guard, parser, JSON Schema, and seeded generator.
|
|
|
63
69
|
`htmlToMarkdown(x)`: whatever the projection emits, markdown can write it and read it back
|
|
64
70
|
unchanged.
|
|
65
71
|
|
|
66
|
-
|
|
72
|
+
Each round-trip law holds within the depth budget — markdown's `MAX_DEPTH`, plus html's own cap on
|
|
67
73
|
the inbound trip; beyond it only totality is promised.
|
|
68
74
|
|
|
69
75
|
- **Sanitized output** — `renderHTML` refuses `javascript:`, `data:`, `vbscript:`, `file:`, and
|