markdown-codec 1.4.2 → 2.0.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 +1 -1
- package/dist/codec.d.cts +77 -5
- package/dist/codec.d.ts +77 -5
- package/dist/emit/emit.cjs +7 -9
- package/dist/emit/emit.js +7 -9
- package/dist/lower/lower.cjs +2 -1
- package/dist/lower/lower.js +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ Every construct `src/lower`/`src/emit` cannot represent losslessly is a document
|
|
|
168
168
|
- **`md/image-unresolved`** — no resolver, `undefined` return, or non-PNG/JPEG bytes degrades to alt-text run.
|
|
169
169
|
- **`md/raw-html-preserved-as-text` / `md/raw-html-dropped`** — raw HTML kept as literal text (default) or dropped; never interpreted.
|
|
170
170
|
- **`md/front-matter-key-unmapped`** — no YAML/TOML engine; only five known `LayoutMetadata` keys recognised.
|
|
171
|
-
- **`md/heading-level-clamped`** — styleId beyond `Heading6` (from another format) clamps to level 6.
|
|
171
|
+
- **`md/heading-level-clamped`** — styleId beyond `Heading6` (from another format) clamps to level 6 via document-schema.js's shared `clampHeadingLevel()`.
|
|
172
172
|
- **`md/adjacent-links-merged`** / **`md/code-span-as-monospace-run`** — same-destination adjacent links merge; monospace runs emit as code spans.
|
|
173
173
|
- **`md/paragraph-indent-dropped`** — `indentLeftPt` without a recognised styleId; indent dropped, paragraph renders.
|
|
174
174
|
- **`md/list-numid-fallback`** — a foreign `numId` falls back to a plain bullet list.
|
package/dist/codec.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
declare const MarkdownBytesSchema: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
4
4
|
declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
5
|
kind: z.ZodLiteral<"wordprocessing">;
|
|
6
|
-
formatVersion: z.ZodLiteral<
|
|
6
|
+
formatVersion: z.ZodLiteral<3>;
|
|
7
7
|
metadata: z.ZodObject<{
|
|
8
8
|
title: z.ZodOptional<z.ZodString>;
|
|
9
9
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -29,7 +29,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
29
29
|
}, z.core.$strip>>;
|
|
30
30
|
}, z.core.$strip>, z.ZodObject<{
|
|
31
31
|
kind: z.ZodLiteral<"presentation">;
|
|
32
|
-
formatVersion: z.ZodLiteral<
|
|
32
|
+
formatVersion: z.ZodLiteral<3>;
|
|
33
33
|
metadata: z.ZodObject<{
|
|
34
34
|
title: z.ZodOptional<z.ZodString>;
|
|
35
35
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -62,13 +62,20 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
62
62
|
lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
|
|
63
63
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
64
64
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
65
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
pageIndex: z.ZodNumber;
|
|
67
|
+
xPt: z.ZodNumber;
|
|
68
|
+
yPt: z.ZodNumber;
|
|
69
|
+
widthPt: z.ZodNumber;
|
|
70
|
+
heightPt: z.ZodNumber;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
65
72
|
blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
|
|
66
73
|
}, z.core.$strip>>;
|
|
67
74
|
notes: z.ZodString;
|
|
68
75
|
}, z.core.$strip>>;
|
|
69
76
|
}, z.core.$strip>, z.ZodObject<{
|
|
70
77
|
kind: z.ZodLiteral<"spreadsheet">;
|
|
71
|
-
formatVersion: z.ZodLiteral<
|
|
78
|
+
formatVersion: z.ZodLiteral<3>;
|
|
72
79
|
metadata: z.ZodObject<{
|
|
73
80
|
title: z.ZodOptional<z.ZodString>;
|
|
74
81
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -135,6 +142,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
135
142
|
}, z.core.$strip>>;
|
|
136
143
|
hyperlink: z.ZodOptional<z.ZodString>;
|
|
137
144
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
145
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
pageIndex: z.ZodNumber;
|
|
147
|
+
xPt: z.ZodNumber;
|
|
148
|
+
yPt: z.ZodNumber;
|
|
149
|
+
widthPt: z.ZodNumber;
|
|
150
|
+
heightPt: z.ZodNumber;
|
|
151
|
+
}, z.core.$strip>>>;
|
|
138
152
|
}, z.core.$strip>>>;
|
|
139
153
|
colSpan: z.ZodOptional<z.ZodNumber>;
|
|
140
154
|
rowSpan: z.ZodOptional<z.ZodNumber>;
|
|
@@ -212,7 +226,23 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
212
226
|
bottom: "bottom";
|
|
213
227
|
middle: "middle";
|
|
214
228
|
}>>;
|
|
229
|
+
comment: z.ZodOptional<z.ZodObject<{
|
|
230
|
+
text: z.ZodString;
|
|
231
|
+
author: z.ZodOptional<z.ZodString>;
|
|
232
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
233
|
+
replies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
234
|
+
text: z.ZodString;
|
|
235
|
+
author: z.ZodOptional<z.ZodString>;
|
|
236
|
+
}, z.core.$strip>>>;
|
|
237
|
+
}, z.core.$strip>>;
|
|
215
238
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
239
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
240
|
+
pageIndex: z.ZodNumber;
|
|
241
|
+
xPt: z.ZodNumber;
|
|
242
|
+
yPt: z.ZodNumber;
|
|
243
|
+
widthPt: z.ZodNumber;
|
|
244
|
+
heightPt: z.ZodNumber;
|
|
245
|
+
}, z.core.$strip>>>;
|
|
216
246
|
}, z.core.$strip>>;
|
|
217
247
|
columns: z.ZodArray<z.ZodObject<{
|
|
218
248
|
index: z.ZodNumber;
|
|
@@ -235,6 +265,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
235
265
|
heightPt: z.ZodNumber;
|
|
236
266
|
altText: z.ZodOptional<z.ZodString>;
|
|
237
267
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
268
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
269
|
+
pageIndex: z.ZodNumber;
|
|
270
|
+
xPt: z.ZodNumber;
|
|
271
|
+
yPt: z.ZodNumber;
|
|
272
|
+
widthPt: z.ZodNumber;
|
|
273
|
+
heightPt: z.ZodNumber;
|
|
274
|
+
}, z.core.$strip>>>;
|
|
238
275
|
anchorRow: z.ZodNumber;
|
|
239
276
|
anchorColumn: z.ZodNumber;
|
|
240
277
|
offsetXPt: z.ZodNumber;
|
|
@@ -285,7 +322,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
285
322
|
}, z.core.$strip>>;
|
|
286
323
|
}, z.core.$strip>, z.ZodObject<{
|
|
287
324
|
kind: z.ZodLiteral<"drawing">;
|
|
288
|
-
formatVersion: z.ZodLiteral<
|
|
325
|
+
formatVersion: z.ZodLiteral<3>;
|
|
289
326
|
metadata: z.ZodObject<{
|
|
290
327
|
title: z.ZodOptional<z.ZodString>;
|
|
291
328
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -318,6 +355,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
318
355
|
lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
|
|
319
356
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
320
357
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
358
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
359
|
+
pageIndex: z.ZodNumber;
|
|
360
|
+
xPt: z.ZodNumber;
|
|
361
|
+
yPt: z.ZodNumber;
|
|
362
|
+
widthPt: z.ZodNumber;
|
|
363
|
+
heightPt: z.ZodNumber;
|
|
364
|
+
}, z.core.$strip>>>;
|
|
321
365
|
blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
|
|
322
366
|
}, z.core.$strip>>;
|
|
323
367
|
vectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -350,6 +394,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
350
394
|
}, z.core.$strip>>;
|
|
351
395
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
352
396
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
397
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
398
|
+
pageIndex: z.ZodNumber;
|
|
399
|
+
xPt: z.ZodNumber;
|
|
400
|
+
yPt: z.ZodNumber;
|
|
401
|
+
widthPt: z.ZodNumber;
|
|
402
|
+
heightPt: z.ZodNumber;
|
|
403
|
+
}, z.core.$strip>>>;
|
|
353
404
|
}, z.core.$strip>, z.ZodObject<{
|
|
354
405
|
kind: z.ZodLiteral<"ellipse">;
|
|
355
406
|
frame: z.ZodObject<{
|
|
@@ -380,6 +431,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
380
431
|
}, z.core.$strip>>;
|
|
381
432
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
382
433
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
434
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
435
|
+
pageIndex: z.ZodNumber;
|
|
436
|
+
xPt: z.ZodNumber;
|
|
437
|
+
yPt: z.ZodNumber;
|
|
438
|
+
widthPt: z.ZodNumber;
|
|
439
|
+
heightPt: z.ZodNumber;
|
|
440
|
+
}, z.core.$strip>>>;
|
|
383
441
|
}, z.core.$strip>, z.ZodObject<{
|
|
384
442
|
kind: z.ZodLiteral<"line">;
|
|
385
443
|
from: z.ZodObject<{
|
|
@@ -406,6 +464,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
406
464
|
}, z.core.$strip>;
|
|
407
465
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
408
466
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
467
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
468
|
+
pageIndex: z.ZodNumber;
|
|
469
|
+
xPt: z.ZodNumber;
|
|
470
|
+
yPt: z.ZodNumber;
|
|
471
|
+
widthPt: z.ZodNumber;
|
|
472
|
+
heightPt: z.ZodNumber;
|
|
473
|
+
}, z.core.$strip>>>;
|
|
409
474
|
}, z.core.$strip>, z.ZodObject<{
|
|
410
475
|
kind: z.ZodLiteral<"path">;
|
|
411
476
|
frame: z.ZodObject<{
|
|
@@ -468,11 +533,18 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
468
533
|
}, z.core.$strip>>;
|
|
469
534
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
470
535
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
536
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
537
|
+
pageIndex: z.ZodNumber;
|
|
538
|
+
xPt: z.ZodNumber;
|
|
539
|
+
yPt: z.ZodNumber;
|
|
540
|
+
widthPt: z.ZodNumber;
|
|
541
|
+
heightPt: z.ZodNumber;
|
|
542
|
+
}, z.core.$strip>>>;
|
|
471
543
|
}, z.core.$strip>], "kind">>;
|
|
472
544
|
}, z.core.$strip>>;
|
|
473
545
|
}, z.core.$strip>, z.ZodObject<{
|
|
474
546
|
kind: z.ZodLiteral<"formula">;
|
|
475
|
-
formatVersion: z.ZodLiteral<
|
|
547
|
+
formatVersion: z.ZodLiteral<3>;
|
|
476
548
|
metadata: z.ZodObject<{
|
|
477
549
|
title: z.ZodOptional<z.ZodString>;
|
|
478
550
|
author: z.ZodOptional<z.ZodString>;
|
package/dist/codec.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
declare const MarkdownBytesSchema: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
4
4
|
declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
5
|
kind: z.ZodLiteral<"wordprocessing">;
|
|
6
|
-
formatVersion: z.ZodLiteral<
|
|
6
|
+
formatVersion: z.ZodLiteral<3>;
|
|
7
7
|
metadata: z.ZodObject<{
|
|
8
8
|
title: z.ZodOptional<z.ZodString>;
|
|
9
9
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -29,7 +29,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
29
29
|
}, z.core.$strip>>;
|
|
30
30
|
}, z.core.$strip>, z.ZodObject<{
|
|
31
31
|
kind: z.ZodLiteral<"presentation">;
|
|
32
|
-
formatVersion: z.ZodLiteral<
|
|
32
|
+
formatVersion: z.ZodLiteral<3>;
|
|
33
33
|
metadata: z.ZodObject<{
|
|
34
34
|
title: z.ZodOptional<z.ZodString>;
|
|
35
35
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -62,13 +62,20 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
62
62
|
lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
|
|
63
63
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
64
64
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
65
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
pageIndex: z.ZodNumber;
|
|
67
|
+
xPt: z.ZodNumber;
|
|
68
|
+
yPt: z.ZodNumber;
|
|
69
|
+
widthPt: z.ZodNumber;
|
|
70
|
+
heightPt: z.ZodNumber;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
65
72
|
blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
|
|
66
73
|
}, z.core.$strip>>;
|
|
67
74
|
notes: z.ZodString;
|
|
68
75
|
}, z.core.$strip>>;
|
|
69
76
|
}, z.core.$strip>, z.ZodObject<{
|
|
70
77
|
kind: z.ZodLiteral<"spreadsheet">;
|
|
71
|
-
formatVersion: z.ZodLiteral<
|
|
78
|
+
formatVersion: z.ZodLiteral<3>;
|
|
72
79
|
metadata: z.ZodObject<{
|
|
73
80
|
title: z.ZodOptional<z.ZodString>;
|
|
74
81
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -135,6 +142,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
135
142
|
}, z.core.$strip>>;
|
|
136
143
|
hyperlink: z.ZodOptional<z.ZodString>;
|
|
137
144
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
145
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
pageIndex: z.ZodNumber;
|
|
147
|
+
xPt: z.ZodNumber;
|
|
148
|
+
yPt: z.ZodNumber;
|
|
149
|
+
widthPt: z.ZodNumber;
|
|
150
|
+
heightPt: z.ZodNumber;
|
|
151
|
+
}, z.core.$strip>>>;
|
|
138
152
|
}, z.core.$strip>>>;
|
|
139
153
|
colSpan: z.ZodOptional<z.ZodNumber>;
|
|
140
154
|
rowSpan: z.ZodOptional<z.ZodNumber>;
|
|
@@ -212,7 +226,23 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
212
226
|
bottom: "bottom";
|
|
213
227
|
middle: "middle";
|
|
214
228
|
}>>;
|
|
229
|
+
comment: z.ZodOptional<z.ZodObject<{
|
|
230
|
+
text: z.ZodString;
|
|
231
|
+
author: z.ZodOptional<z.ZodString>;
|
|
232
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
233
|
+
replies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
234
|
+
text: z.ZodString;
|
|
235
|
+
author: z.ZodOptional<z.ZodString>;
|
|
236
|
+
}, z.core.$strip>>>;
|
|
237
|
+
}, z.core.$strip>>;
|
|
215
238
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
239
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
240
|
+
pageIndex: z.ZodNumber;
|
|
241
|
+
xPt: z.ZodNumber;
|
|
242
|
+
yPt: z.ZodNumber;
|
|
243
|
+
widthPt: z.ZodNumber;
|
|
244
|
+
heightPt: z.ZodNumber;
|
|
245
|
+
}, z.core.$strip>>>;
|
|
216
246
|
}, z.core.$strip>>;
|
|
217
247
|
columns: z.ZodArray<z.ZodObject<{
|
|
218
248
|
index: z.ZodNumber;
|
|
@@ -235,6 +265,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
235
265
|
heightPt: z.ZodNumber;
|
|
236
266
|
altText: z.ZodOptional<z.ZodString>;
|
|
237
267
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
268
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
269
|
+
pageIndex: z.ZodNumber;
|
|
270
|
+
xPt: z.ZodNumber;
|
|
271
|
+
yPt: z.ZodNumber;
|
|
272
|
+
widthPt: z.ZodNumber;
|
|
273
|
+
heightPt: z.ZodNumber;
|
|
274
|
+
}, z.core.$strip>>>;
|
|
238
275
|
anchorRow: z.ZodNumber;
|
|
239
276
|
anchorColumn: z.ZodNumber;
|
|
240
277
|
offsetXPt: z.ZodNumber;
|
|
@@ -285,7 +322,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
285
322
|
}, z.core.$strip>>;
|
|
286
323
|
}, z.core.$strip>, z.ZodObject<{
|
|
287
324
|
kind: z.ZodLiteral<"drawing">;
|
|
288
|
-
formatVersion: z.ZodLiteral<
|
|
325
|
+
formatVersion: z.ZodLiteral<3>;
|
|
289
326
|
metadata: z.ZodObject<{
|
|
290
327
|
title: z.ZodOptional<z.ZodString>;
|
|
291
328
|
author: z.ZodOptional<z.ZodString>;
|
|
@@ -318,6 +355,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
318
355
|
lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
|
|
319
356
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
320
357
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
358
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
359
|
+
pageIndex: z.ZodNumber;
|
|
360
|
+
xPt: z.ZodNumber;
|
|
361
|
+
yPt: z.ZodNumber;
|
|
362
|
+
widthPt: z.ZodNumber;
|
|
363
|
+
heightPt: z.ZodNumber;
|
|
364
|
+
}, z.core.$strip>>>;
|
|
321
365
|
blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
|
|
322
366
|
}, z.core.$strip>>;
|
|
323
367
|
vectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -350,6 +394,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
350
394
|
}, z.core.$strip>>;
|
|
351
395
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
352
396
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
397
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
398
|
+
pageIndex: z.ZodNumber;
|
|
399
|
+
xPt: z.ZodNumber;
|
|
400
|
+
yPt: z.ZodNumber;
|
|
401
|
+
widthPt: z.ZodNumber;
|
|
402
|
+
heightPt: z.ZodNumber;
|
|
403
|
+
}, z.core.$strip>>>;
|
|
353
404
|
}, z.core.$strip>, z.ZodObject<{
|
|
354
405
|
kind: z.ZodLiteral<"ellipse">;
|
|
355
406
|
frame: z.ZodObject<{
|
|
@@ -380,6 +431,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
380
431
|
}, z.core.$strip>>;
|
|
381
432
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
382
433
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
434
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
435
|
+
pageIndex: z.ZodNumber;
|
|
436
|
+
xPt: z.ZodNumber;
|
|
437
|
+
yPt: z.ZodNumber;
|
|
438
|
+
widthPt: z.ZodNumber;
|
|
439
|
+
heightPt: z.ZodNumber;
|
|
440
|
+
}, z.core.$strip>>>;
|
|
383
441
|
}, z.core.$strip>, z.ZodObject<{
|
|
384
442
|
kind: z.ZodLiteral<"line">;
|
|
385
443
|
from: z.ZodObject<{
|
|
@@ -406,6 +464,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
406
464
|
}, z.core.$strip>;
|
|
407
465
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
408
466
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
467
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
468
|
+
pageIndex: z.ZodNumber;
|
|
469
|
+
xPt: z.ZodNumber;
|
|
470
|
+
yPt: z.ZodNumber;
|
|
471
|
+
widthPt: z.ZodNumber;
|
|
472
|
+
heightPt: z.ZodNumber;
|
|
473
|
+
}, z.core.$strip>>>;
|
|
409
474
|
}, z.core.$strip>, z.ZodObject<{
|
|
410
475
|
kind: z.ZodLiteral<"path">;
|
|
411
476
|
frame: z.ZodObject<{
|
|
@@ -468,11 +533,18 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
468
533
|
}, z.core.$strip>>;
|
|
469
534
|
paintOrder: z.ZodOptional<z.ZodNumber>;
|
|
470
535
|
sourcePath: z.ZodOptional<z.ZodString>;
|
|
536
|
+
frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
537
|
+
pageIndex: z.ZodNumber;
|
|
538
|
+
xPt: z.ZodNumber;
|
|
539
|
+
yPt: z.ZodNumber;
|
|
540
|
+
widthPt: z.ZodNumber;
|
|
541
|
+
heightPt: z.ZodNumber;
|
|
542
|
+
}, z.core.$strip>>>;
|
|
471
543
|
}, z.core.$strip>], "kind">>;
|
|
472
544
|
}, z.core.$strip>>;
|
|
473
545
|
}, z.core.$strip>, z.ZodObject<{
|
|
474
546
|
kind: z.ZodLiteral<"formula">;
|
|
475
|
-
formatVersion: z.ZodLiteral<
|
|
547
|
+
formatVersion: z.ZodLiteral<3>;
|
|
476
548
|
metadata: z.ZodObject<{
|
|
477
549
|
title: z.ZodOptional<z.ZodString>;
|
|
478
550
|
author: z.ZodOptional<z.ZodString>;
|
package/dist/emit/emit.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const require_emit_front_matter = require("./front-matter.cjs");
|
|
|
7
7
|
const require_emit_inline = require("./inline.cjs");
|
|
8
8
|
const require_emit_image = require("./image.cjs");
|
|
9
9
|
const require_emit_table = require("./table.cjs");
|
|
10
|
+
let document_schema_js = require("document-schema.js");
|
|
10
11
|
//#region src/emit/emit.ts
|
|
11
12
|
const MAX_SETEXT_LEVEL = 2;
|
|
12
13
|
const SETEXT_LEVEL_1_CHAR = "=";
|
|
@@ -56,15 +57,12 @@ function renderParagraphBody(paragraph, context) {
|
|
|
56
57
|
if (paragraph.styleId === "MathBlock") return `$$\n${paragraph.runs.map((run) => run.text).join("")}\n$$`;
|
|
57
58
|
const headingLevel = paragraph.styleId === void 0 ? void 0 : require_shared_style_constants.parseHeadingStyleId(paragraph.styleId);
|
|
58
59
|
if (headingLevel !== void 0) {
|
|
59
|
-
|
|
60
|
-
if (level
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
level = 6;
|
|
67
|
-
}
|
|
60
|
+
const level = (0, document_schema_js.clampHeadingLevel)(headingLevel);
|
|
61
|
+
if (level !== headingLevel) context.sink({
|
|
62
|
+
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.HEADING_LEVEL_CLAMPED,
|
|
63
|
+
severity: "info",
|
|
64
|
+
message: `heading level ${String(headingLevel)} exceeds ATX's own six-"#" ceiling and is clamped to ${String(level)}`
|
|
65
|
+
});
|
|
68
66
|
const text = require_emit_inline.emitRuns(paragraph.runs, context);
|
|
69
67
|
if (context.headingStyle === "setext" && level <= MAX_SETEXT_LEVEL) return renderSetextHeading(level, text);
|
|
70
68
|
return `${"#".repeat(level)} ${text}`;
|
package/dist/emit/emit.js
CHANGED
|
@@ -6,6 +6,7 @@ import { emitFrontMatter } from "./front-matter.js";
|
|
|
6
6
|
import { emitRuns } from "./inline.js";
|
|
7
7
|
import { emitImage } from "./image.js";
|
|
8
8
|
import { emitTable } from "./table.js";
|
|
9
|
+
import { clampHeadingLevel } from "document-schema.js";
|
|
9
10
|
//#region src/emit/emit.ts
|
|
10
11
|
const MAX_SETEXT_LEVEL = 2;
|
|
11
12
|
const SETEXT_LEVEL_1_CHAR = "=";
|
|
@@ -55,15 +56,12 @@ function renderParagraphBody(paragraph, context) {
|
|
|
55
56
|
if (paragraph.styleId === "MathBlock") return `$$\n${paragraph.runs.map((run) => run.text).join("")}\n$$`;
|
|
56
57
|
const headingLevel = paragraph.styleId === void 0 ? void 0 : parseHeadingStyleId(paragraph.styleId);
|
|
57
58
|
if (headingLevel !== void 0) {
|
|
58
|
-
|
|
59
|
-
if (level
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
level = 6;
|
|
66
|
-
}
|
|
59
|
+
const level = clampHeadingLevel(headingLevel);
|
|
60
|
+
if (level !== headingLevel) context.sink({
|
|
61
|
+
code: MarkdownDiagnosticCodes.HEADING_LEVEL_CLAMPED,
|
|
62
|
+
severity: "info",
|
|
63
|
+
message: `heading level ${String(headingLevel)} exceeds ATX's own six-"#" ceiling and is clamped to ${String(level)}`
|
|
64
|
+
});
|
|
67
65
|
const text = emitRuns(paragraph.runs, context);
|
|
68
66
|
if (context.headingStyle === "setext" && level <= MAX_SETEXT_LEVEL) return renderSetextHeading(level, text);
|
|
69
67
|
return `${"#".repeat(level)} ${text}`;
|
package/dist/lower/lower.cjs
CHANGED
|
@@ -36,7 +36,8 @@ function lowerHeading(node, context) {
|
|
|
36
36
|
return [decorateParagraph({
|
|
37
37
|
kind: "paragraph",
|
|
38
38
|
runs: require_lower_inline.lowerInlineNodes(node.children, inlineContext(context)),
|
|
39
|
-
styleId: require_shared_style_constants.headingStyleId(node.level)
|
|
39
|
+
styleId: require_shared_style_constants.headingStyleId(node.level),
|
|
40
|
+
headingLevel: node.level
|
|
40
41
|
}, context)];
|
|
41
42
|
}
|
|
42
43
|
function lowerParagraph(node, context) {
|
package/dist/lower/lower.js
CHANGED
|
@@ -35,7 +35,8 @@ function lowerHeading(node, context) {
|
|
|
35
35
|
return [decorateParagraph({
|
|
36
36
|
kind: "paragraph",
|
|
37
37
|
runs: lowerInlineNodes(node.children, inlineContext(context)),
|
|
38
|
-
styleId: headingStyleId(node.level)
|
|
38
|
+
styleId: headingStyleId(node.level),
|
|
39
|
+
headingLevel: node.level
|
|
39
40
|
}, context)];
|
|
40
41
|
}
|
|
41
42
|
function lowerParagraph(node, context) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-codec",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Hand-written CommonMark+GFM <-> ContentDocument codec, built on document-schema.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"license": "MIT",
|
|
80
80
|
"packageManager": "pnpm@11.6.0",
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"document-schema.js": "^
|
|
82
|
+
"document-schema.js": "^3.1.0",
|
|
83
83
|
"zod": "^4.4.3"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|