markdown-codec 5.0.3 → 6.1.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/README.md +36 -35
- package/dist/ast/ast.d.cts +1 -1
- package/dist/ast/ast.d.ts +1 -1
- package/dist/{ast-8XCbjRQT.d.cts → ast-CNfTgS0N.d.cts} +35 -35
- package/dist/{ast-8XCbjRQT.d.ts → ast-CNfTgS0N.d.ts} +35 -35
- package/dist/block/block.d.cts +3 -3
- package/dist/block/block.d.ts +3 -3
- package/dist/block/definitions.d.cts +1 -1
- package/dist/block/definitions.d.ts +1 -1
- package/dist/block/node.d.cts +4 -4
- package/dist/block/node.d.ts +4 -4
- package/dist/block/table.d.cts +1 -1
- package/dist/block/table.d.ts +1 -1
- package/dist/codec.cjs +1 -1
- package/dist/codec.d.cts +10 -10
- package/dist/codec.d.ts +10 -10
- package/dist/codec.js +2 -2
- package/dist/defaults/defaults.d.cts +1 -1
- package/dist/defaults/defaults.d.ts +1 -1
- package/dist/diagnostics/diagnostics.d.cts +1 -1
- package/dist/diagnostics/diagnostics.d.ts +1 -1
- package/dist/{diagnostics-CkcSYZf1.d.cts → diagnostics-CH-xa2-s.d.cts} +5 -5
- package/dist/{diagnostics-CkcSYZf1.d.ts → diagnostics-CH-xa2-s.d.ts} +5 -5
- package/dist/emit/emit.cjs +1 -1
- package/dist/emit/emit.js +1 -1
- package/dist/emit/inline.cjs +2 -2
- package/dist/emit/inline.d.cts +3 -3
- package/dist/emit/inline.d.ts +3 -3
- package/dist/emit/inline.js +2 -2
- package/dist/emit/table.d.cts +1 -1
- package/dist/emit/table.d.ts +1 -1
- package/dist/html/render.d.cts +1 -1
- package/dist/html/render.d.ts +1 -1
- package/dist/image/image.cjs +4 -4
- package/dist/image/image.d.cts +1 -1
- package/dist/image/image.d.ts +1 -1
- package/dist/image/image.js +4 -4
- package/dist/{image-C4KYmz_L.d.cts → image-B5L0HpAJ.d.cts} +1 -1
- package/dist/{image-DescdRgq.d.cts → image-BtmTG4_a.d.cts} +1 -1
- package/dist/{image-DescdRgq.d.ts → image-BtmTG4_a.d.ts} +1 -1
- package/dist/{image-Cm3hT5PS.d.ts → image-C390OIB3.d.ts} +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/inline/delimiter.d.cts +2 -2
- package/dist/inline/delimiter.d.ts +2 -2
- package/dist/inline/inline.d.cts +1 -1
- package/dist/inline/inline.d.ts +1 -1
- package/dist/inline/node.d.cts +2 -2
- package/dist/inline/node.d.ts +2 -2
- package/dist/{inline-CoS1JzxI.d.cts → inline-CnO86zMw.d.cts} +1 -1
- package/dist/{inline-OGXVE6hB.d.ts → inline-DItZ-VVw.d.ts} +1 -1
- package/dist/lower/front-matter.d.cts +1 -1
- package/dist/lower/front-matter.d.ts +1 -1
- package/dist/lower/image.d.cts +1 -1
- package/dist/lower/image.d.ts +1 -1
- package/dist/lower/inline.d.cts +3 -3
- package/dist/lower/inline.d.ts +3 -3
- package/dist/lower/table.d.cts +1 -1
- package/dist/lower/table.d.ts +1 -1
- package/dist/options/options.d.cts +10 -10
- package/dist/options/options.d.ts +10 -10
- package/dist/read.cjs +1 -1
- package/dist/read.d.cts +3 -3
- package/dist/read.d.ts +3 -3
- package/dist/read.js +2 -2
- package/dist/scan/entity-table.cjs +2125 -2125
- package/dist/scan/entity-table.js +2125 -2125
- package/dist/shared/list-id.d.cts +3 -3
- package/dist/shared/list-id.d.ts +3 -3
- package/dist/write.cjs +2 -2
- package/dist/write.d.cts +2 -2
- package/dist/write.d.ts +2 -2
- package/dist/write.js +3 -3
- package/package.json +3 -12
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/ExaDev/documents.js/tree/main/packages/markdown-codec) [](https://www.npmjs.com/package/markdown-codec) [](https://www.npmjs.com/package/markdown-codec) [](https://github.com/ExaDev/documents.js/actions)
|
|
4
4
|
|
|
5
|
-
> Hand-written CommonMark+GFM ⇄ `
|
|
5
|
+
> Hand-written CommonMark+GFM ⇄ `DocumentTree` codec, built on [document-schema.js](../document-schema.js/README.md).
|
|
6
6
|
|
|
7
|
-
The same "hand-write the format instead of wrapping a third-party library" bet as [`pdf-codec`](../pdf-codec/README.md), aimed at CommonMark and GFM. No `micromark`/`remark`/`marked`/`markdown-it`/`commonmark`/`mdast`/`unified`/`turndown`/`showdown` dependency (enforced by eslint `no-restricted-imports`). Runtime dependencies: `document-schema.js` (the shared pivot) and `zod`. `readMarkdown`/`writeMarkdown` read and write that pivot's tree-form `
|
|
7
|
+
The same "hand-write the format instead of wrapping a third-party library" bet as [`pdf-codec`](../pdf-codec/README.md), aimed at CommonMark and GFM. No `micromark`/`remark`/`marked`/`markdown-it`/`commonmark`/`mdast`/`unified`/`turndown`/`showdown` dependency (enforced by eslint `no-restricted-imports`). Runtime dependencies: `document-schema.js` (the shared pivot) and `zod`. `readMarkdown`/`writeMarkdown` read and write that pivot's tree-form `DocumentTree`; `readMarkdownContent`/`writeMarkdownContent` read and write the flat `ContentDocument` underneath it — the same model [`documents.js`](https://github.com/ExaDev/documents.js) builds docx/pptx/odt/odp conversions around. See [Two encodings](#two-encodings-documenttree-and-contentdocument).
|
|
8
8
|
|
|
9
9
|
```mermaid
|
|
10
10
|
graph TD
|
|
@@ -76,30 +76,33 @@ Published to [npmjs.org](https://www.npmjs.com/package/markdown-codec) via OIDC
|
|
|
76
76
|
Reading and writing markdown text:
|
|
77
77
|
|
|
78
78
|
```ts
|
|
79
|
-
import { readMarkdown, writeMarkdown } from
|
|
79
|
+
import { readMarkdown, writeMarkdown } from "markdown-codec";
|
|
80
80
|
|
|
81
|
-
const { documentPackage, diagnostics } = readMarkdown(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const { documentPackage, diagnostics } = readMarkdown(
|
|
82
|
+
"# Title\n\nSome **bold** text with a [link](https://example.com).",
|
|
83
|
+
{
|
|
84
|
+
frontMatter: true, // parse a leading YAML front matter block into the package's metadata
|
|
85
|
+
footnotes: true, // recognise [^label] markers and [^label]: definitions (default; see Footnotes)
|
|
86
|
+
images: (destination) => undefined, // a synchronous MarkdownImageResolver port for non-data: URI images
|
|
87
|
+
},
|
|
88
|
+
);
|
|
86
89
|
|
|
87
90
|
const markdown = writeMarkdown(documentPackage, {
|
|
88
|
-
bulletListMarker:
|
|
89
|
-
emphasisMarker:
|
|
91
|
+
bulletListMarker: "-",
|
|
92
|
+
emphasisMarker: "_",
|
|
90
93
|
frontMatter: true, // emit the package's metadata back out as a leading front matter block
|
|
91
94
|
});
|
|
92
95
|
```
|
|
93
96
|
|
|
94
|
-
`documentPackage` is a `
|
|
97
|
+
`documentPackage` is a `DocumentTree` — document-schema.js's tree form, with a minted styles table (see [Two encodings](#two-encodings-documenttree-and-contentdocument)). The field is named `documentPackage` rather than `package` because `package` is a reserved word in strict mode, so `const { package } = readMarkdown(src)` would not parse.
|
|
95
98
|
|
|
96
|
-
Both accept an optional `signal` (`AbortSignal`) and `sink` (`MarkdownDiagnosticSink`, called once per recoverable issue or construct-mapping gap — see [Gotchas](#gotchas-and-quirks)). `writeMarkdown` throws `MarkdownUnsupportedDocumentKindError` for a package whose `kind` is not `'wordprocessing'`, checked before flattening so every non-`'wordprocessing'` package reaches it the same way regardless of what else about that package would have failed document-schema.js's own `
|
|
99
|
+
Both accept an optional `signal` (`AbortSignal`) and `sink` (`MarkdownDiagnosticSink`, called once per recoverable issue or construct-mapping gap — see [Gotchas](#gotchas-and-quirks)). `writeMarkdown` throws `MarkdownUnsupportedDocumentKindError` for a package whose `kind` is not `'wordprocessing'`, checked before flattening so every non-`'wordprocessing'` package reaches it the same way regardless of what else about that package would have failed document-schema.js's own `flattenTree`. A `'wordprocessing'` package can still fail to flatten — a group carrying a style reference the package's own `styles` table has no entry for — and that failure surfaces as `MarkdownPackageFlattenError`, not a bare `Error` from the dependency. A `DocumentTree`'s own `layers`/`attachments`/`destinations`/`pages` tables have no flat-`ContentDocument` home to land in; `writeMarkdown` reports one `PACKAGE_TABLE_DROPPED` diagnostic per non-empty table it finds rather than dropping them without a trace. The `definitions` table is the one exemption: this package's own link-tenant entries (what `readMarkdown` splices there from the source's reference definitions) render back out as `[label]: destination "title"` lines, so only a table holding foreign tenants reports.
|
|
97
100
|
|
|
98
101
|
The same round trip as a schema-validated [`z.codec()`](https://zod.dev) pair, mirroring `pdf-codec`'s `pdfCodec`:
|
|
99
102
|
|
|
100
103
|
```ts
|
|
101
|
-
import { z } from
|
|
102
|
-
import { markdownCodec, MarkdownBytesSchema } from
|
|
104
|
+
import { z } from "zod";
|
|
105
|
+
import { markdownCodec, MarkdownBytesSchema } from "markdown-codec";
|
|
103
106
|
|
|
104
107
|
const documentPackage = z.decode(markdownCodec, bytes); // throws if bytes are not well-formed UTF-8
|
|
105
108
|
const bytes2 = z.encode(markdownCodec, documentPackage);
|
|
@@ -107,23 +110,23 @@ const bytes2 = z.encode(markdownCodec, documentPackage);
|
|
|
107
110
|
|
|
108
111
|
`MarkdownBytesSchema` checks for well-formed UTF-8. The no-options form only; `readMarkdown`/`writeMarkdown` remain the entry points for an `AbortSignal` or diagnostic sink. Every construct-mapping gap reports through the sink as a stable code (e.g. `md/nested-emphasis-flattened`) — see `MarkdownDiagnosticCodes` and [Gotchas](#gotchas-and-quirks).
|
|
109
112
|
|
|
110
|
-
## Two encodings: `
|
|
113
|
+
## Two encodings: `DocumentTree` and `ContentDocument`
|
|
111
114
|
|
|
112
|
-
document-schema.js states one document in two shapes, and owns the transform between them: the flat `ContentDocument` every codec's lowering pipeline actually builds, and the tree-form `
|
|
115
|
+
document-schema.js states one document in two shapes, and owns the transform between them: the flat `ContentDocument` every codec's lowering pipeline actually builds, and the tree-form `DocumentTree` a serialised artefact carries — sections, headings, lists, and construct boundaries as real nested groups, plus a styles table minted over repeated property tuples. `assembleTree` goes flat → tree (`decompose` then `factorStyles`), `flattenTree` goes tree → flat. Only one direction is a genuine round trip: `flattenTree(assembleTree(document))` reproduces `document` exactly, for any `ContentDocument` this package's own read side produces (checked against the full CommonMark and GFM conformance corpora, not just a hand-picked fixture — see `src/conformance.test.ts`/`src/gfm-conformance.test.ts`'s own "tree pair matches the flat pair" suite). `assembleTree(flattenTree(documentPackage))` does not, in general, reproduce `documentPackage` — a package carrying `definitions`/`layers`/`attachments`/`destinations`/`pages` loses all of them on the way through `flattenTree`, which carries forward only `metadata` and `symbolTable` (see [Gotchas](#gotchas-and-quirks)).
|
|
113
116
|
|
|
114
117
|
This package exposes a read/write pair and a codec at each level. The unsuffixed names are the tree-form ones and are what to reach for by default — a codec is a construction site, so the tree is what a caller gets unless they ask for otherwise. The `Content`-suffixed names are the flat pair one level down, mirroring the `readXlsx`/`readXlsxContent` naming already in [`ooxml.js`](../ooxml.js/README.md):
|
|
115
118
|
|
|
116
|
-
| Level
|
|
117
|
-
|
|
|
118
|
-
| Tree (default) | `readMarkdown`
|
|
119
|
-
| Flat
|
|
119
|
+
| Level | Read | Write | Codec | Value type |
|
|
120
|
+
| -------------- | --------------------- | ---------------------- | ---------------------- | ----------------- |
|
|
121
|
+
| Tree (default) | `readMarkdown` | `writeMarkdown` | `markdownCodec` | `DocumentTree` |
|
|
122
|
+
| Flat | `readMarkdownContent` | `writeMarkdownContent` | `markdownContentCodec` | `ContentDocument` |
|
|
120
123
|
|
|
121
|
-
The tree pair is the flat pair with the transform composed on — `readMarkdown` is `
|
|
124
|
+
The tree pair is the flat pair with the transform composed on — `readMarkdown` is `assembleTree` over `readMarkdownContent`, `writeMarkdown` is `flattenTree` before `writeMarkdownContent` — plus the two tree-only carries the flat form has no root for: the source's reference definitions splice into `documentPackage.definitions` (link tenant, keyed by normalised label) and the verbatim front-matter block into `documentPackage.source.frontmatter`, both rendered back out by `writeMarkdown` (`[label]: dest "title"` lines after the body; the original front matter verbatim in place of the regenerated block). Sources carrying neither render identically to the flat pair, pinned in `src/package.test.ts`; a source carrying either renders its extra block, which is the point of reaching for the tree. Options, diagnostics, and error behaviour are identical at both levels.
|
|
122
125
|
|
|
123
|
-
Reach for the flat pair when composing a package boundary by hand (`decompose`/`
|
|
126
|
+
Reach for the flat pair when composing a package boundary by hand (`decompose`/`flattenTree` directly, or `factorStyles` with your own minting policy), when feeding a `ContentDocument`-consuming builder such as `documents.js`'s conversion pipeline, or when a layout stage needs to stamp frames onto content before it is decomposed. Everything else wants the tree.
|
|
124
127
|
|
|
125
128
|
```ts
|
|
126
|
-
import { readMarkdownContent, writeMarkdownContent } from
|
|
129
|
+
import { readMarkdownContent, writeMarkdownContent } from "markdown-codec";
|
|
127
130
|
|
|
128
131
|
const { document } = readMarkdownContent(source); // a ContentDocument: kind, metadata, sections
|
|
129
132
|
const markdown = writeMarkdownContent(document);
|
|
@@ -144,7 +147,7 @@ Modelled on `pdf-codec`'s own layering, aimed at CommonMark+GFM instead of PDF:
|
|
|
144
147
|
- **`src/shared/`** — string-shape conventions `src/lower`/`src/emit` agree on (`style-constants.ts`, `list-id.ts`'s opaque `numId`). Re-exported so `documents.js`'s `MarkdownEditor` reuses the identical grammar.
|
|
145
148
|
- **`src/lower/`** — AST → `ContentDocument` lowering (thin adapter, not a second parser); top-of-file table maps each construct to its diagnostic gap.
|
|
146
149
|
- **`src/emit/`** — `ContentDocument` → markdown text emission, the structural inverse of `src/lower`.
|
|
147
|
-
- **`src/read.ts`** / **`src/write.ts`** / **`src/codec.ts`** — the public entry points at both levels: `readMarkdown`/`writeMarkdown`/`markdownCodec` over `
|
|
150
|
+
- **`src/read.ts`** / **`src/write.ts`** / **`src/codec.ts`** — the public entry points at both levels: `readMarkdown`/`writeMarkdown`/`markdownCodec` over `DocumentTree`, and `readMarkdownContent`/`writeMarkdownContent`/`markdownContentCodec` over `ContentDocument`. The tree-form functions are thin compositions of `document-schema.js`'s `assembleTree`/`flattenTree` onto the flat ones; no conversion logic of their own lives here.
|
|
148
151
|
|
|
149
152
|
## Vendored assets
|
|
150
153
|
|
|
@@ -202,7 +205,7 @@ Every construct `src/lower`/`src/emit` cannot represent losslessly is a document
|
|
|
202
205
|
- **`md/duplicate-footnote-definition`** — two definitions share a label; every reference resolves to the first, both are kept as written.
|
|
203
206
|
- **`md/footnote-body-heading-flattened`** — a heading inside a definition body is carried as literal ATX text, since a construct extent may not open or close a heading scope.
|
|
204
207
|
- **`md/construct-unrepresented`** — a construct kind markdown has no syntax for renders transparently: its extent still appears, the construct itself does not.
|
|
205
|
-
- **`md/package-table-dropped`** — `writeMarkdown` only, ahead of flattening: a `
|
|
208
|
+
- **`md/package-table-dropped`** — `writeMarkdown` only, ahead of flattening: a `DocumentTree`'s own `definitions`/`layers`/`attachments`/`destinations`/`pages` table has no flat-`ContentDocument` home (`flattenTree`'s own envelope carries forward only `metadata` and `symbolTable`); fires once per non-empty table present.
|
|
206
209
|
|
|
207
210
|
## Footnotes
|
|
208
211
|
|
|
@@ -210,8 +213,8 @@ GitHub's footnote extension (`[^label]` markers, `[^label]: body` definitions) i
|
|
|
210
213
|
|
|
211
214
|
The two halves of a footnote map onto the **same `anchor` construct at two different scopes**, and that split is structural rather than a choice:
|
|
212
215
|
|
|
213
|
-
- **A definition becomes an `anchor` construct.** Lowering emits document-schema.js's construct boundary markers — a `constructStart` carrying `{ kind: 'anchor', anchorType: 'footnote', name }`, the definition's own lowered body blocks, and a `constructEnd` — which is what `readMarkdownContent` returns in its block flow, and what `decompose` promotes to a construct group of its own in the `
|
|
214
|
-
- **A reference site becomes a point run-level `anchor` extent.** A reference sits between two runs inside a paragraph, so no block-level boundary marker can bracket it without splitting the paragraph in two — but a run-level construct extent (`RunConstructExtent` on `ContentParagraph.constructs`, document-schema.js 4.5.0) names exactly that shape. Lowering emits an ordinary text run keeping the reference's own `[^label]` spelling (the materialised rendering, so a consumer that ignores constructs still shows `[^1]`) plus a point extent — `{ kind: 'anchor', anchorType: 'footnote', name }` at `startRun === endRun` naming that run, the same wiring ooxml.js's docx reader mints for a `w:footnoteReference` — carried through `decompose`/`
|
|
216
|
+
- **A definition becomes an `anchor` construct.** Lowering emits document-schema.js's construct boundary markers — a `constructStart` carrying `{ kind: 'anchor', anchorType: 'footnote', name }`, the definition's own lowered body blocks, and a `constructEnd` — which is what `readMarkdownContent` returns in its block flow, and what `decompose` promotes to a construct group of its own in the `DocumentTree` `readMarkdown` returns (the descriptor rides the group's `node`, the body blocks its `children`). The body rides the construct's extent rather than `AnchorDescriptor.definition`, which names a key in a package-level definitions table: `DocumentTree` does carry that table as a root (unlike the flat `ContentDocument`), but a table entry there is a flat descriptor record, not a container for block content, so a body that is genuinely several paragraphs, a code block, or a list still has nowhere to live as a table value either way — the construct's own bracketed extent is the one shape in this schema built to hold real block content. A bodyless `[^1]:` lowers to the point anchor the same descriptor describes: a pair with nothing between it.
|
|
217
|
+
- **A reference site becomes a point run-level `anchor` extent.** A reference sits between two runs inside a paragraph, so no block-level boundary marker can bracket it without splitting the paragraph in two — but a run-level construct extent (`RunConstructExtent` on `ContentParagraph.constructs`, document-schema.js 4.5.0) names exactly that shape. Lowering emits an ordinary text run keeping the reference's own `[^label]` spelling (the materialised rendering, so a consumer that ignores constructs still shows `[^1]`) plus a point extent — `{ kind: 'anchor', anchorType: 'footnote', name }` at `startRun === endRun` naming that run, the same wiring ooxml.js's docx reader mints for a `w:footnoteReference` — carried through `decompose`/`flattenTree` verbatim, exactly the way a table cell's own markers are. The writer spells `[^label]` back out from the covering extent rather than from anything about the run's text (which is what still distinguishes a genuine reference from a deliberately-escaped literal `\[^1\]`), gated by the same label grammar as the definition marker: a foreign name that grammar cannot spell degrades to the run's own escaped text plus `md/construct-unrepresented`.
|
|
215
218
|
|
|
216
219
|
Definitions are recognised only at the document's own top level. Inside a block quote or a list item, the pair's extent would sit inside a scope the enclosing container had already opened, which the marker contract forbids a producer from emitting — so the text stays an ordinary paragraph there. A heading inside a definition body is flattened to literal ATX text for the same reason.
|
|
217
220
|
|
|
@@ -223,18 +226,16 @@ Emission is the inverse and validates first: a section's markers must pair as ba
|
|
|
223
226
|
|
|
224
227
|
**Round-trip conformance rate** (read → write → reparse → render to HTML, compared byte for byte against expected HTML):
|
|
225
228
|
|
|
226
|
-
| Corpus
|
|
227
|
-
|
|
|
228
|
-
| CommonMark 0.31.2 (`assets/commonmark/spec.json`)
|
|
229
|
-
| GFM tagged extensions (table/strikethrough/autolink/task-list, `assets/gfm/spec.txt`) | 23
|
|
230
|
-
| Combined
|
|
229
|
+
| Corpus | Examples | Passing round trip | Rate |
|
|
230
|
+
| ------------------------------------------------------------------------------------- | -------- | ------------------ | ----- |
|
|
231
|
+
| CommonMark 0.31.2 (`assets/commonmark/spec.json`) | 652 | 511 | 78.4% |
|
|
232
|
+
| GFM tagged extensions (table/strikethrough/autolink/task-list, `assets/gfm/spec.txt`) | 23 | 22 | 95.7% |
|
|
233
|
+
| Combined | 675 | 533 | 79.0% |
|
|
231
234
|
|
|
232
235
|
Every non-passing example is named individually in `src/test-support/conformance-exclusions.ts`, attributed to a closed set of causes (shrink-only — see [Conventions](#conventions)): most commonly a soft line break collapsing to a space, a nested/unresolved image title, an emphasis-span collision, or a blockquote whose heading content skips its container pair.
|
|
233
236
|
|
|
234
237
|
**Optional real-world corpus.** `test/corpus/` (gitignored) holds a `pnpm test:corpus` project for a manual sanity check against sibling READMEs on disk — asserts no throw and real content on reparse, not byte fidelity. Not part of `pnpm test`; run locally before significant parser/lower/emit changes.
|
|
235
238
|
|
|
236
|
-
|
|
237
|
-
|
|
238
239
|
## Release and publishing
|
|
239
240
|
|
|
240
241
|
Release, CI, and commit-message conventions are all workspace-wide, not package-local — see the [monorepo root README](../../README.md#releases) for the mechanism (topological per-package `semantic-release` via `@exadev/semantic-release-workspace`, OIDC trusted npm publishing, automatic sibling dependency-range rewriting) and its [post-release republishing and attestation](../../README.md#releases) note on the restored GitHub Packages mirrors, npm aliases, and SBOM/provenance signing.
|
|
@@ -245,7 +246,7 @@ Conventional Commits, enforced workspace-wide by commitlint through a root `comm
|
|
|
245
246
|
|
|
246
247
|
## References
|
|
247
248
|
|
|
248
|
-
- [document-schema.js](../document-schema.js/README.md) — owns both shared encodings (`ContentDocument`, `
|
|
249
|
+
- [document-schema.js](../document-schema.js/README.md) — owns both shared encodings (`ContentDocument`, `DocumentTree`) and the `assembleTree`/`flattenTree` transform between them.
|
|
249
250
|
- [pdf-codec](../pdf-codec/README.md) — the sibling whose scaffold, tooling, and "hand-write the format" philosophy this project mirrors.
|
|
250
251
|
- [documents.js](https://github.com/ExaDev/documents.js) — bridges markdown to docx/odt/PDF via this package's `ContentDocument` (the flat pair; its own conversion pipeline assembles the package itself). Markdown has no presentation/spreadsheet/drawing variant, so pptx/odp/ods/odg are structurally out of reach.
|
|
251
252
|
- [CommonMark Spec](https://spec.commonmark.org/) — the base specification targeted.
|
package/dist/ast/ast.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as MarkdownSoftBreakNode, B as isMarkdownInlineNode, C as MarkdownMathBlockNode, D as MarkdownParagraphNode, E as MarkdownOrderedListDelimiter, F as MarkdownTableNode, I as MarkdownTableRowNode, L as MarkdownTextNode, M as MarkdownStrongNode, N as MarkdownTableAlignment, O as MarkdownPosition, P as MarkdownTableCellNode, R as MarkdownThematicBreakNode, S as MarkdownListNode, T as MarkdownNode, _ as MarkdownImageNode, a as MarkdownCodeBlockNode, b as MarkdownListItemNode, c as MarkdownEmphasisMarker, d as MarkdownFootnoteDefinitionNode, f as MarkdownFootnoteReferenceNode, g as MarkdownHtmlBlockNode, h as MarkdownHeadingStyle, i as MarkdownBulletMarker, j as MarkdownStrikethroughNode, k as MarkdownRawHtmlNode, l as MarkdownEmphasisNode, m as MarkdownHeadingNode, n as MarkdownBlockNode, o as MarkdownCodeSpanNode, p as MarkdownHardBreakNode, r as MarkdownBlockquoteNode, s as MarkdownDocumentNode, t as MarkdownAutolinkNode, u as MarkdownEntityNode, v as MarkdownInlineNode, w as MarkdownMathInlineNode, x as MarkdownListMarkerType, y as MarkdownLinkNode, z as isMarkdownBlockNode } from "../ast-
|
|
1
|
+
import { A as MarkdownSoftBreakNode, B as isMarkdownInlineNode, C as MarkdownMathBlockNode, D as MarkdownParagraphNode, E as MarkdownOrderedListDelimiter, F as MarkdownTableNode, I as MarkdownTableRowNode, L as MarkdownTextNode, M as MarkdownStrongNode, N as MarkdownTableAlignment, O as MarkdownPosition, P as MarkdownTableCellNode, R as MarkdownThematicBreakNode, S as MarkdownListNode, T as MarkdownNode, _ as MarkdownImageNode, a as MarkdownCodeBlockNode, b as MarkdownListItemNode, c as MarkdownEmphasisMarker, d as MarkdownFootnoteDefinitionNode, f as MarkdownFootnoteReferenceNode, g as MarkdownHtmlBlockNode, h as MarkdownHeadingStyle, i as MarkdownBulletMarker, j as MarkdownStrikethroughNode, k as MarkdownRawHtmlNode, l as MarkdownEmphasisNode, m as MarkdownHeadingNode, n as MarkdownBlockNode, o as MarkdownCodeSpanNode, p as MarkdownHardBreakNode, r as MarkdownBlockquoteNode, s as MarkdownDocumentNode, t as MarkdownAutolinkNode, u as MarkdownEntityNode, v as MarkdownInlineNode, w as MarkdownMathInlineNode, x as MarkdownListMarkerType, y as MarkdownLinkNode, z as isMarkdownBlockNode } from "../ast-CNfTgS0N.cjs";
|
|
2
2
|
export { MarkdownAutolinkNode, MarkdownBlockNode, MarkdownBlockquoteNode, MarkdownBulletMarker, MarkdownCodeBlockNode, MarkdownCodeSpanNode, MarkdownDocumentNode, MarkdownEmphasisMarker, MarkdownEmphasisNode, MarkdownEntityNode, MarkdownFootnoteDefinitionNode, MarkdownFootnoteReferenceNode, MarkdownHardBreakNode, MarkdownHeadingNode, MarkdownHeadingStyle, MarkdownHtmlBlockNode, MarkdownImageNode, MarkdownInlineNode, MarkdownLinkNode, MarkdownListItemNode, MarkdownListMarkerType, MarkdownListNode, MarkdownMathBlockNode, MarkdownMathInlineNode, MarkdownNode, MarkdownOrderedListDelimiter, MarkdownParagraphNode, MarkdownPosition, MarkdownRawHtmlNode, MarkdownSoftBreakNode, MarkdownStrikethroughNode, MarkdownStrongNode, MarkdownTableAlignment, MarkdownTableCellNode, MarkdownTableNode, MarkdownTableRowNode, MarkdownTextNode, MarkdownThematicBreakNode, isMarkdownBlockNode, isMarkdownInlineNode };
|
package/dist/ast/ast.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as MarkdownSoftBreakNode, B as isMarkdownInlineNode, C as MarkdownMathBlockNode, D as MarkdownParagraphNode, E as MarkdownOrderedListDelimiter, F as MarkdownTableNode, I as MarkdownTableRowNode, L as MarkdownTextNode, M as MarkdownStrongNode, N as MarkdownTableAlignment, O as MarkdownPosition, P as MarkdownTableCellNode, R as MarkdownThematicBreakNode, S as MarkdownListNode, T as MarkdownNode, _ as MarkdownImageNode, a as MarkdownCodeBlockNode, b as MarkdownListItemNode, c as MarkdownEmphasisMarker, d as MarkdownFootnoteDefinitionNode, f as MarkdownFootnoteReferenceNode, g as MarkdownHtmlBlockNode, h as MarkdownHeadingStyle, i as MarkdownBulletMarker, j as MarkdownStrikethroughNode, k as MarkdownRawHtmlNode, l as MarkdownEmphasisNode, m as MarkdownHeadingNode, n as MarkdownBlockNode, o as MarkdownCodeSpanNode, p as MarkdownHardBreakNode, r as MarkdownBlockquoteNode, s as MarkdownDocumentNode, t as MarkdownAutolinkNode, u as MarkdownEntityNode, v as MarkdownInlineNode, w as MarkdownMathInlineNode, x as MarkdownListMarkerType, y as MarkdownLinkNode, z as isMarkdownBlockNode } from "../ast-
|
|
1
|
+
import { A as MarkdownSoftBreakNode, B as isMarkdownInlineNode, C as MarkdownMathBlockNode, D as MarkdownParagraphNode, E as MarkdownOrderedListDelimiter, F as MarkdownTableNode, I as MarkdownTableRowNode, L as MarkdownTextNode, M as MarkdownStrongNode, N as MarkdownTableAlignment, O as MarkdownPosition, P as MarkdownTableCellNode, R as MarkdownThematicBreakNode, S as MarkdownListNode, T as MarkdownNode, _ as MarkdownImageNode, a as MarkdownCodeBlockNode, b as MarkdownListItemNode, c as MarkdownEmphasisMarker, d as MarkdownFootnoteDefinitionNode, f as MarkdownFootnoteReferenceNode, g as MarkdownHtmlBlockNode, h as MarkdownHeadingStyle, i as MarkdownBulletMarker, j as MarkdownStrikethroughNode, k as MarkdownRawHtmlNode, l as MarkdownEmphasisNode, m as MarkdownHeadingNode, n as MarkdownBlockNode, o as MarkdownCodeSpanNode, p as MarkdownHardBreakNode, r as MarkdownBlockquoteNode, s as MarkdownDocumentNode, t as MarkdownAutolinkNode, u as MarkdownEntityNode, v as MarkdownInlineNode, w as MarkdownMathInlineNode, x as MarkdownListMarkerType, y as MarkdownLinkNode, z as isMarkdownBlockNode } from "../ast-CNfTgS0N.js";
|
|
2
2
|
export { MarkdownAutolinkNode, MarkdownBlockNode, MarkdownBlockquoteNode, MarkdownBulletMarker, MarkdownCodeBlockNode, MarkdownCodeSpanNode, MarkdownDocumentNode, MarkdownEmphasisMarker, MarkdownEmphasisNode, MarkdownEntityNode, MarkdownFootnoteDefinitionNode, MarkdownFootnoteReferenceNode, MarkdownHardBreakNode, MarkdownHeadingNode, MarkdownHeadingStyle, MarkdownHtmlBlockNode, MarkdownImageNode, MarkdownInlineNode, MarkdownLinkNode, MarkdownListItemNode, MarkdownListMarkerType, MarkdownListNode, MarkdownMathBlockNode, MarkdownMathInlineNode, MarkdownNode, MarkdownOrderedListDelimiter, MarkdownParagraphNode, MarkdownPosition, MarkdownRawHtmlNode, MarkdownSoftBreakNode, MarkdownStrikethroughNode, MarkdownStrongNode, MarkdownTableAlignment, MarkdownTableCellNode, MarkdownTableNode, MarkdownTableRowNode, MarkdownTextNode, MarkdownThematicBreakNode, isMarkdownBlockNode, isMarkdownInlineNode };
|
|
@@ -8,33 +8,33 @@ interface MarkdownPosition {
|
|
|
8
8
|
type MarkdownNode = MarkdownBlockNode | MarkdownInlineNode;
|
|
9
9
|
type MarkdownBlockNode = MarkdownDocumentNode | MarkdownParagraphNode | MarkdownHeadingNode | MarkdownBlockquoteNode | MarkdownListNode | MarkdownListItemNode | MarkdownCodeBlockNode | MarkdownThematicBreakNode | MarkdownHtmlBlockNode | MarkdownTableNode | MarkdownTableRowNode | MarkdownTableCellNode | MarkdownMathBlockNode | MarkdownFootnoteDefinitionNode;
|
|
10
10
|
interface MarkdownDocumentNode {
|
|
11
|
-
readonly type:
|
|
11
|
+
readonly type: "document";
|
|
12
12
|
readonly children: MarkdownBlockNode[];
|
|
13
13
|
readonly position?: MarkdownPosition;
|
|
14
14
|
}
|
|
15
15
|
interface MarkdownParagraphNode {
|
|
16
|
-
readonly type:
|
|
16
|
+
readonly type: "paragraph";
|
|
17
17
|
readonly children: MarkdownInlineNode[];
|
|
18
18
|
readonly position?: MarkdownPosition;
|
|
19
19
|
}
|
|
20
|
-
type MarkdownHeadingStyle =
|
|
20
|
+
type MarkdownHeadingStyle = "atx" | "setext";
|
|
21
21
|
interface MarkdownHeadingNode {
|
|
22
|
-
readonly type:
|
|
22
|
+
readonly type: "heading";
|
|
23
23
|
readonly level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
24
24
|
readonly style: MarkdownHeadingStyle;
|
|
25
25
|
readonly children: MarkdownInlineNode[];
|
|
26
26
|
readonly position?: MarkdownPosition;
|
|
27
27
|
}
|
|
28
28
|
interface MarkdownBlockquoteNode {
|
|
29
|
-
readonly type:
|
|
29
|
+
readonly type: "blockquote";
|
|
30
30
|
readonly children: MarkdownBlockNode[];
|
|
31
31
|
readonly position?: MarkdownPosition;
|
|
32
32
|
}
|
|
33
|
-
type MarkdownListMarkerType =
|
|
34
|
-
type MarkdownBulletMarker =
|
|
35
|
-
type MarkdownOrderedListDelimiter =
|
|
33
|
+
type MarkdownListMarkerType = "bullet" | "ordered";
|
|
34
|
+
type MarkdownBulletMarker = "-" | "*" | "+";
|
|
35
|
+
type MarkdownOrderedListDelimiter = "." | ")";
|
|
36
36
|
interface MarkdownListNode {
|
|
37
|
-
readonly type:
|
|
37
|
+
readonly type: "list";
|
|
38
38
|
readonly markerType: MarkdownListMarkerType;
|
|
39
39
|
readonly bulletMarker?: MarkdownBulletMarker;
|
|
40
40
|
readonly orderedDelimiter?: MarkdownOrderedListDelimiter;
|
|
@@ -44,95 +44,95 @@ interface MarkdownListNode {
|
|
|
44
44
|
readonly position?: MarkdownPosition;
|
|
45
45
|
}
|
|
46
46
|
interface MarkdownListItemNode {
|
|
47
|
-
readonly type:
|
|
47
|
+
readonly type: "listItem";
|
|
48
48
|
readonly checked?: boolean;
|
|
49
49
|
readonly children: MarkdownBlockNode[];
|
|
50
50
|
readonly position?: MarkdownPosition;
|
|
51
51
|
}
|
|
52
52
|
interface MarkdownCodeBlockNode {
|
|
53
|
-
readonly type:
|
|
53
|
+
readonly type: "codeBlock";
|
|
54
54
|
readonly fenced: boolean;
|
|
55
|
-
readonly fenceChar?:
|
|
55
|
+
readonly fenceChar?: "`" | "~";
|
|
56
56
|
readonly infoString?: string;
|
|
57
57
|
readonly literal: string;
|
|
58
58
|
readonly position?: MarkdownPosition;
|
|
59
59
|
}
|
|
60
60
|
interface MarkdownThematicBreakNode {
|
|
61
|
-
readonly type:
|
|
61
|
+
readonly type: "thematicBreak";
|
|
62
62
|
readonly position?: MarkdownPosition;
|
|
63
63
|
}
|
|
64
64
|
interface MarkdownHtmlBlockNode {
|
|
65
|
-
readonly type:
|
|
65
|
+
readonly type: "htmlBlock";
|
|
66
66
|
readonly literal: string;
|
|
67
67
|
readonly position?: MarkdownPosition;
|
|
68
68
|
}
|
|
69
|
-
type MarkdownTableAlignment =
|
|
69
|
+
type MarkdownTableAlignment = "left" | "right" | "center" | "none";
|
|
70
70
|
interface MarkdownTableNode {
|
|
71
|
-
readonly type:
|
|
71
|
+
readonly type: "table";
|
|
72
72
|
readonly alignments: MarkdownTableAlignment[];
|
|
73
73
|
readonly children: MarkdownTableRowNode[];
|
|
74
74
|
readonly position?: MarkdownPosition;
|
|
75
75
|
}
|
|
76
76
|
interface MarkdownTableRowNode {
|
|
77
|
-
readonly type:
|
|
77
|
+
readonly type: "tableRow";
|
|
78
78
|
readonly header: boolean;
|
|
79
79
|
readonly children: MarkdownTableCellNode[];
|
|
80
80
|
readonly position?: MarkdownPosition;
|
|
81
81
|
}
|
|
82
82
|
interface MarkdownTableCellNode {
|
|
83
|
-
readonly type:
|
|
83
|
+
readonly type: "tableCell";
|
|
84
84
|
readonly children: MarkdownInlineNode[];
|
|
85
85
|
readonly position?: MarkdownPosition;
|
|
86
86
|
}
|
|
87
87
|
interface MarkdownMathBlockNode {
|
|
88
|
-
readonly type:
|
|
88
|
+
readonly type: "mathBlock";
|
|
89
89
|
readonly literal: string;
|
|
90
90
|
readonly position?: MarkdownPosition;
|
|
91
91
|
}
|
|
92
92
|
interface MarkdownFootnoteDefinitionNode {
|
|
93
|
-
readonly type:
|
|
93
|
+
readonly type: "footnoteDefinition";
|
|
94
94
|
readonly label: string;
|
|
95
95
|
readonly children: MarkdownBlockNode[];
|
|
96
96
|
readonly position?: MarkdownPosition;
|
|
97
97
|
}
|
|
98
98
|
type MarkdownInlineNode = MarkdownTextNode | MarkdownEmphasisNode | MarkdownStrongNode | MarkdownStrikethroughNode | MarkdownCodeSpanNode | MarkdownLinkNode | MarkdownImageNode | MarkdownAutolinkNode | MarkdownHardBreakNode | MarkdownSoftBreakNode | MarkdownRawHtmlNode | MarkdownEntityNode | MarkdownMathInlineNode | MarkdownFootnoteReferenceNode;
|
|
99
|
-
type MarkdownEmphasisMarker =
|
|
99
|
+
type MarkdownEmphasisMarker = "_" | "*";
|
|
100
100
|
interface MarkdownTextNode {
|
|
101
|
-
readonly type:
|
|
101
|
+
readonly type: "text";
|
|
102
102
|
readonly value: string;
|
|
103
103
|
readonly position?: MarkdownPosition;
|
|
104
104
|
}
|
|
105
105
|
interface MarkdownEmphasisNode {
|
|
106
|
-
readonly type:
|
|
106
|
+
readonly type: "emphasis";
|
|
107
107
|
readonly marker: MarkdownEmphasisMarker;
|
|
108
108
|
readonly children: MarkdownInlineNode[];
|
|
109
109
|
readonly position?: MarkdownPosition;
|
|
110
110
|
}
|
|
111
111
|
interface MarkdownStrongNode {
|
|
112
|
-
readonly type:
|
|
112
|
+
readonly type: "strong";
|
|
113
113
|
readonly marker: MarkdownEmphasisMarker;
|
|
114
114
|
readonly children: MarkdownInlineNode[];
|
|
115
115
|
readonly position?: MarkdownPosition;
|
|
116
116
|
}
|
|
117
117
|
interface MarkdownStrikethroughNode {
|
|
118
|
-
readonly type:
|
|
118
|
+
readonly type: "strikethrough";
|
|
119
119
|
readonly children: MarkdownInlineNode[];
|
|
120
120
|
readonly position?: MarkdownPosition;
|
|
121
121
|
}
|
|
122
122
|
interface MarkdownCodeSpanNode {
|
|
123
|
-
readonly type:
|
|
123
|
+
readonly type: "codeSpan";
|
|
124
124
|
readonly literal: string;
|
|
125
125
|
readonly position?: MarkdownPosition;
|
|
126
126
|
}
|
|
127
127
|
interface MarkdownLinkNode {
|
|
128
|
-
readonly type:
|
|
128
|
+
readonly type: "link";
|
|
129
129
|
readonly destination: string;
|
|
130
130
|
readonly title?: string;
|
|
131
131
|
readonly children: MarkdownInlineNode[];
|
|
132
132
|
readonly position?: MarkdownPosition;
|
|
133
133
|
}
|
|
134
134
|
interface MarkdownImageNode {
|
|
135
|
-
readonly type:
|
|
135
|
+
readonly type: "image";
|
|
136
136
|
readonly destination: string;
|
|
137
137
|
readonly title?: string;
|
|
138
138
|
readonly alt: string;
|
|
@@ -141,37 +141,37 @@ interface MarkdownImageNode {
|
|
|
141
141
|
readonly position?: MarkdownPosition;
|
|
142
142
|
}
|
|
143
143
|
interface MarkdownAutolinkNode {
|
|
144
|
-
readonly type:
|
|
144
|
+
readonly type: "autolink";
|
|
145
145
|
readonly destination: string;
|
|
146
146
|
readonly email: boolean;
|
|
147
147
|
readonly position?: MarkdownPosition;
|
|
148
148
|
}
|
|
149
149
|
interface MarkdownHardBreakNode {
|
|
150
|
-
readonly type:
|
|
150
|
+
readonly type: "hardBreak";
|
|
151
151
|
readonly position?: MarkdownPosition;
|
|
152
152
|
}
|
|
153
153
|
interface MarkdownSoftBreakNode {
|
|
154
|
-
readonly type:
|
|
154
|
+
readonly type: "softBreak";
|
|
155
155
|
readonly position?: MarkdownPosition;
|
|
156
156
|
}
|
|
157
157
|
interface MarkdownRawHtmlNode {
|
|
158
|
-
readonly type:
|
|
158
|
+
readonly type: "rawHtml";
|
|
159
159
|
readonly literal: string;
|
|
160
160
|
readonly position?: MarkdownPosition;
|
|
161
161
|
}
|
|
162
162
|
interface MarkdownEntityNode {
|
|
163
|
-
readonly type:
|
|
163
|
+
readonly type: "entity";
|
|
164
164
|
readonly raw: string;
|
|
165
165
|
readonly value: string;
|
|
166
166
|
readonly position?: MarkdownPosition;
|
|
167
167
|
}
|
|
168
168
|
interface MarkdownMathInlineNode {
|
|
169
|
-
readonly type:
|
|
169
|
+
readonly type: "mathInline";
|
|
170
170
|
readonly literal: string;
|
|
171
171
|
readonly position?: MarkdownPosition;
|
|
172
172
|
}
|
|
173
173
|
interface MarkdownFootnoteReferenceNode {
|
|
174
|
-
readonly type:
|
|
174
|
+
readonly type: "footnoteReference";
|
|
175
175
|
readonly label: string;
|
|
176
176
|
readonly position?: MarkdownPosition;
|
|
177
177
|
}
|
|
@@ -8,33 +8,33 @@ interface MarkdownPosition {
|
|
|
8
8
|
type MarkdownNode = MarkdownBlockNode | MarkdownInlineNode;
|
|
9
9
|
type MarkdownBlockNode = MarkdownDocumentNode | MarkdownParagraphNode | MarkdownHeadingNode | MarkdownBlockquoteNode | MarkdownListNode | MarkdownListItemNode | MarkdownCodeBlockNode | MarkdownThematicBreakNode | MarkdownHtmlBlockNode | MarkdownTableNode | MarkdownTableRowNode | MarkdownTableCellNode | MarkdownMathBlockNode | MarkdownFootnoteDefinitionNode;
|
|
10
10
|
interface MarkdownDocumentNode {
|
|
11
|
-
readonly type:
|
|
11
|
+
readonly type: "document";
|
|
12
12
|
readonly children: MarkdownBlockNode[];
|
|
13
13
|
readonly position?: MarkdownPosition;
|
|
14
14
|
}
|
|
15
15
|
interface MarkdownParagraphNode {
|
|
16
|
-
readonly type:
|
|
16
|
+
readonly type: "paragraph";
|
|
17
17
|
readonly children: MarkdownInlineNode[];
|
|
18
18
|
readonly position?: MarkdownPosition;
|
|
19
19
|
}
|
|
20
|
-
type MarkdownHeadingStyle =
|
|
20
|
+
type MarkdownHeadingStyle = "atx" | "setext";
|
|
21
21
|
interface MarkdownHeadingNode {
|
|
22
|
-
readonly type:
|
|
22
|
+
readonly type: "heading";
|
|
23
23
|
readonly level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
24
24
|
readonly style: MarkdownHeadingStyle;
|
|
25
25
|
readonly children: MarkdownInlineNode[];
|
|
26
26
|
readonly position?: MarkdownPosition;
|
|
27
27
|
}
|
|
28
28
|
interface MarkdownBlockquoteNode {
|
|
29
|
-
readonly type:
|
|
29
|
+
readonly type: "blockquote";
|
|
30
30
|
readonly children: MarkdownBlockNode[];
|
|
31
31
|
readonly position?: MarkdownPosition;
|
|
32
32
|
}
|
|
33
|
-
type MarkdownListMarkerType =
|
|
34
|
-
type MarkdownBulletMarker =
|
|
35
|
-
type MarkdownOrderedListDelimiter =
|
|
33
|
+
type MarkdownListMarkerType = "bullet" | "ordered";
|
|
34
|
+
type MarkdownBulletMarker = "-" | "*" | "+";
|
|
35
|
+
type MarkdownOrderedListDelimiter = "." | ")";
|
|
36
36
|
interface MarkdownListNode {
|
|
37
|
-
readonly type:
|
|
37
|
+
readonly type: "list";
|
|
38
38
|
readonly markerType: MarkdownListMarkerType;
|
|
39
39
|
readonly bulletMarker?: MarkdownBulletMarker;
|
|
40
40
|
readonly orderedDelimiter?: MarkdownOrderedListDelimiter;
|
|
@@ -44,95 +44,95 @@ interface MarkdownListNode {
|
|
|
44
44
|
readonly position?: MarkdownPosition;
|
|
45
45
|
}
|
|
46
46
|
interface MarkdownListItemNode {
|
|
47
|
-
readonly type:
|
|
47
|
+
readonly type: "listItem";
|
|
48
48
|
readonly checked?: boolean;
|
|
49
49
|
readonly children: MarkdownBlockNode[];
|
|
50
50
|
readonly position?: MarkdownPosition;
|
|
51
51
|
}
|
|
52
52
|
interface MarkdownCodeBlockNode {
|
|
53
|
-
readonly type:
|
|
53
|
+
readonly type: "codeBlock";
|
|
54
54
|
readonly fenced: boolean;
|
|
55
|
-
readonly fenceChar?:
|
|
55
|
+
readonly fenceChar?: "`" | "~";
|
|
56
56
|
readonly infoString?: string;
|
|
57
57
|
readonly literal: string;
|
|
58
58
|
readonly position?: MarkdownPosition;
|
|
59
59
|
}
|
|
60
60
|
interface MarkdownThematicBreakNode {
|
|
61
|
-
readonly type:
|
|
61
|
+
readonly type: "thematicBreak";
|
|
62
62
|
readonly position?: MarkdownPosition;
|
|
63
63
|
}
|
|
64
64
|
interface MarkdownHtmlBlockNode {
|
|
65
|
-
readonly type:
|
|
65
|
+
readonly type: "htmlBlock";
|
|
66
66
|
readonly literal: string;
|
|
67
67
|
readonly position?: MarkdownPosition;
|
|
68
68
|
}
|
|
69
|
-
type MarkdownTableAlignment =
|
|
69
|
+
type MarkdownTableAlignment = "left" | "right" | "center" | "none";
|
|
70
70
|
interface MarkdownTableNode {
|
|
71
|
-
readonly type:
|
|
71
|
+
readonly type: "table";
|
|
72
72
|
readonly alignments: MarkdownTableAlignment[];
|
|
73
73
|
readonly children: MarkdownTableRowNode[];
|
|
74
74
|
readonly position?: MarkdownPosition;
|
|
75
75
|
}
|
|
76
76
|
interface MarkdownTableRowNode {
|
|
77
|
-
readonly type:
|
|
77
|
+
readonly type: "tableRow";
|
|
78
78
|
readonly header: boolean;
|
|
79
79
|
readonly children: MarkdownTableCellNode[];
|
|
80
80
|
readonly position?: MarkdownPosition;
|
|
81
81
|
}
|
|
82
82
|
interface MarkdownTableCellNode {
|
|
83
|
-
readonly type:
|
|
83
|
+
readonly type: "tableCell";
|
|
84
84
|
readonly children: MarkdownInlineNode[];
|
|
85
85
|
readonly position?: MarkdownPosition;
|
|
86
86
|
}
|
|
87
87
|
interface MarkdownMathBlockNode {
|
|
88
|
-
readonly type:
|
|
88
|
+
readonly type: "mathBlock";
|
|
89
89
|
readonly literal: string;
|
|
90
90
|
readonly position?: MarkdownPosition;
|
|
91
91
|
}
|
|
92
92
|
interface MarkdownFootnoteDefinitionNode {
|
|
93
|
-
readonly type:
|
|
93
|
+
readonly type: "footnoteDefinition";
|
|
94
94
|
readonly label: string;
|
|
95
95
|
readonly children: MarkdownBlockNode[];
|
|
96
96
|
readonly position?: MarkdownPosition;
|
|
97
97
|
}
|
|
98
98
|
type MarkdownInlineNode = MarkdownTextNode | MarkdownEmphasisNode | MarkdownStrongNode | MarkdownStrikethroughNode | MarkdownCodeSpanNode | MarkdownLinkNode | MarkdownImageNode | MarkdownAutolinkNode | MarkdownHardBreakNode | MarkdownSoftBreakNode | MarkdownRawHtmlNode | MarkdownEntityNode | MarkdownMathInlineNode | MarkdownFootnoteReferenceNode;
|
|
99
|
-
type MarkdownEmphasisMarker =
|
|
99
|
+
type MarkdownEmphasisMarker = "_" | "*";
|
|
100
100
|
interface MarkdownTextNode {
|
|
101
|
-
readonly type:
|
|
101
|
+
readonly type: "text";
|
|
102
102
|
readonly value: string;
|
|
103
103
|
readonly position?: MarkdownPosition;
|
|
104
104
|
}
|
|
105
105
|
interface MarkdownEmphasisNode {
|
|
106
|
-
readonly type:
|
|
106
|
+
readonly type: "emphasis";
|
|
107
107
|
readonly marker: MarkdownEmphasisMarker;
|
|
108
108
|
readonly children: MarkdownInlineNode[];
|
|
109
109
|
readonly position?: MarkdownPosition;
|
|
110
110
|
}
|
|
111
111
|
interface MarkdownStrongNode {
|
|
112
|
-
readonly type:
|
|
112
|
+
readonly type: "strong";
|
|
113
113
|
readonly marker: MarkdownEmphasisMarker;
|
|
114
114
|
readonly children: MarkdownInlineNode[];
|
|
115
115
|
readonly position?: MarkdownPosition;
|
|
116
116
|
}
|
|
117
117
|
interface MarkdownStrikethroughNode {
|
|
118
|
-
readonly type:
|
|
118
|
+
readonly type: "strikethrough";
|
|
119
119
|
readonly children: MarkdownInlineNode[];
|
|
120
120
|
readonly position?: MarkdownPosition;
|
|
121
121
|
}
|
|
122
122
|
interface MarkdownCodeSpanNode {
|
|
123
|
-
readonly type:
|
|
123
|
+
readonly type: "codeSpan";
|
|
124
124
|
readonly literal: string;
|
|
125
125
|
readonly position?: MarkdownPosition;
|
|
126
126
|
}
|
|
127
127
|
interface MarkdownLinkNode {
|
|
128
|
-
readonly type:
|
|
128
|
+
readonly type: "link";
|
|
129
129
|
readonly destination: string;
|
|
130
130
|
readonly title?: string;
|
|
131
131
|
readonly children: MarkdownInlineNode[];
|
|
132
132
|
readonly position?: MarkdownPosition;
|
|
133
133
|
}
|
|
134
134
|
interface MarkdownImageNode {
|
|
135
|
-
readonly type:
|
|
135
|
+
readonly type: "image";
|
|
136
136
|
readonly destination: string;
|
|
137
137
|
readonly title?: string;
|
|
138
138
|
readonly alt: string;
|
|
@@ -141,37 +141,37 @@ interface MarkdownImageNode {
|
|
|
141
141
|
readonly position?: MarkdownPosition;
|
|
142
142
|
}
|
|
143
143
|
interface MarkdownAutolinkNode {
|
|
144
|
-
readonly type:
|
|
144
|
+
readonly type: "autolink";
|
|
145
145
|
readonly destination: string;
|
|
146
146
|
readonly email: boolean;
|
|
147
147
|
readonly position?: MarkdownPosition;
|
|
148
148
|
}
|
|
149
149
|
interface MarkdownHardBreakNode {
|
|
150
|
-
readonly type:
|
|
150
|
+
readonly type: "hardBreak";
|
|
151
151
|
readonly position?: MarkdownPosition;
|
|
152
152
|
}
|
|
153
153
|
interface MarkdownSoftBreakNode {
|
|
154
|
-
readonly type:
|
|
154
|
+
readonly type: "softBreak";
|
|
155
155
|
readonly position?: MarkdownPosition;
|
|
156
156
|
}
|
|
157
157
|
interface MarkdownRawHtmlNode {
|
|
158
|
-
readonly type:
|
|
158
|
+
readonly type: "rawHtml";
|
|
159
159
|
readonly literal: string;
|
|
160
160
|
readonly position?: MarkdownPosition;
|
|
161
161
|
}
|
|
162
162
|
interface MarkdownEntityNode {
|
|
163
|
-
readonly type:
|
|
163
|
+
readonly type: "entity";
|
|
164
164
|
readonly raw: string;
|
|
165
165
|
readonly value: string;
|
|
166
166
|
readonly position?: MarkdownPosition;
|
|
167
167
|
}
|
|
168
168
|
interface MarkdownMathInlineNode {
|
|
169
|
-
readonly type:
|
|
169
|
+
readonly type: "mathInline";
|
|
170
170
|
readonly literal: string;
|
|
171
171
|
readonly position?: MarkdownPosition;
|
|
172
172
|
}
|
|
173
173
|
interface MarkdownFootnoteReferenceNode {
|
|
174
|
-
readonly type:
|
|
174
|
+
readonly type: "footnoteReference";
|
|
175
175
|
readonly label: string;
|
|
176
176
|
readonly position?: MarkdownPosition;
|
|
177
177
|
}
|
package/dist/block/block.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { s as MarkdownDocumentNode } from "../ast-
|
|
1
|
+
import { s as MarkdownDocumentNode } from "../ast-CNfTgS0N.cjs";
|
|
2
2
|
import { r as FootnoteLabelSet } from "../footnote-CKk4JbLk.cjs";
|
|
3
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
3
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CH-xa2-s.cjs";
|
|
4
4
|
import { LinkReferenceMap } from "../inline/link.cjs";
|
|
5
|
-
import { t as InlineParseOptions } from "../inline-
|
|
5
|
+
import { t as InlineParseOptions } from "../inline-CnO86zMw.cjs";
|
|
6
6
|
//#region src/block/block.d.ts
|
|
7
7
|
interface MarkdownParseOptions extends InlineParseOptions {
|
|
8
8
|
readonly gfmTables?: boolean;
|