markdown-codec 1.4.2 → 3.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 CHANGED
@@ -168,10 +168,10 @@ 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
- - **`md/list-numid-fallback`** — a foreign `numId` falls back to a plain bullet list.
174
+ - **`md/list-numid-fallback`** — a foreign or absent `numId` (depth-only `ContentListMembership`) falls back to a plain bullet list.
175
175
  - **`md/table-cell-formatting-dropped`** / **`md/table-cell-multi-paragraph-joined`** — GFM cells have no rich-formatting or multi-paragraph representation.
176
176
 
177
177
  ## Fidelity
package/dist/codec.d.cts CHANGED
@@ -2,18 +2,6 @@ import { z } from "zod";
2
2
  //#region src/codec.d.ts
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
- kind: z.ZodLiteral<"wordprocessing">;
6
- formatVersion: z.ZodLiteral<2>;
7
- metadata: z.ZodObject<{
8
- title: z.ZodOptional<z.ZodString>;
9
- author: z.ZodOptional<z.ZodString>;
10
- subject: z.ZodOptional<z.ZodString>;
11
- keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
- creator: z.ZodOptional<z.ZodString>;
13
- producer: z.ZodOptional<z.ZodString>;
14
- createdIso: z.ZodOptional<z.ZodString>;
15
- modifiedIso: z.ZodOptional<z.ZodString>;
16
- }, z.core.$strip>;
17
5
  sections: z.ZodArray<z.ZodObject<{
18
6
  pageSize: z.ZodObject<{
19
7
  widthPt: z.ZodNumber;
@@ -27,9 +15,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
27
15
  }, z.core.$strip>;
28
16
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
29
17
  }, z.core.$strip>>;
30
- }, z.core.$strip>, z.ZodObject<{
31
- kind: z.ZodLiteral<"presentation">;
32
- formatVersion: z.ZodLiteral<2>;
18
+ symbolTable: z.ZodOptional<z.ZodObject<{
19
+ symbols: z.ZodArray<z.ZodObject<{
20
+ glyph: z.ZodString;
21
+ scope: z.ZodString;
22
+ id: z.ZodString;
23
+ quantityKind: z.ZodOptional<z.ZodString>;
24
+ preferredUnit: z.ZodOptional<z.ZodString>;
25
+ definitionSource: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>>;
27
+ units: z.ZodArray<z.ZodObject<{
28
+ id: z.ZodString;
29
+ symbol: z.ZodString;
30
+ name: z.ZodOptional<z.ZodString>;
31
+ dimension: z.ZodRecord<z.ZodEnum<{
32
+ time: "time";
33
+ length: "length";
34
+ mass: "mass";
35
+ electricCurrent: "electricCurrent";
36
+ thermodynamicTemperature: "thermodynamicTemperature";
37
+ amountOfSubstance: "amountOfSubstance";
38
+ luminousIntensity: "luminousIntensity";
39
+ }> & z.core.$partial, z.ZodNumber>;
40
+ factorToSi: z.ZodObject<{
41
+ numerator: z.ZodString;
42
+ denominator: z.ZodString;
43
+ }, z.core.$strip>;
44
+ offsetToSi: z.ZodOptional<z.ZodObject<{
45
+ numerator: z.ZodString;
46
+ denominator: z.ZodString;
47
+ }, z.core.$strip>>;
48
+ context: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>>;
50
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
+ id: z.ZodString;
52
+ bases: z.ZodArray<z.ZodObject<{
53
+ unit: z.ZodString;
54
+ value: z.ZodObject<{
55
+ numerator: z.ZodString;
56
+ denominator: z.ZodString;
57
+ }, z.core.$strip>;
58
+ }, z.core.$strip>>;
59
+ }, z.core.$strip>>>;
60
+ }, z.core.$strip>>;
61
+ kind: z.ZodLiteral<"wordprocessing">;
33
62
  metadata: z.ZodObject<{
34
63
  title: z.ZodOptional<z.ZodString>;
35
64
  author: z.ZodOptional<z.ZodString>;
@@ -40,6 +69,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
40
69
  createdIso: z.ZodOptional<z.ZodString>;
41
70
  modifiedIso: z.ZodOptional<z.ZodString>;
42
71
  }, z.core.$strip>;
72
+ }, z.core.$strip>, z.ZodObject<{
43
73
  slides: z.ZodArray<z.ZodObject<{
44
74
  size: z.ZodObject<{
45
75
  widthPt: z.ZodNumber;
@@ -62,13 +92,61 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
62
92
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
63
93
  paintOrder: z.ZodOptional<z.ZodNumber>;
64
94
  sourcePath: z.ZodOptional<z.ZodString>;
95
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
96
+ pageIndex: z.ZodNumber;
97
+ xPt: z.ZodNumber;
98
+ yPt: z.ZodNumber;
99
+ widthPt: z.ZodNumber;
100
+ heightPt: z.ZodNumber;
101
+ }, z.core.$strip>>>;
65
102
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
66
103
  }, z.core.$strip>>;
67
104
  notes: z.ZodString;
68
105
  }, z.core.$strip>>;
69
- }, z.core.$strip>, z.ZodObject<{
70
- kind: z.ZodLiteral<"spreadsheet">;
71
- formatVersion: z.ZodLiteral<2>;
106
+ symbolTable: z.ZodOptional<z.ZodObject<{
107
+ symbols: z.ZodArray<z.ZodObject<{
108
+ glyph: z.ZodString;
109
+ scope: z.ZodString;
110
+ id: z.ZodString;
111
+ quantityKind: z.ZodOptional<z.ZodString>;
112
+ preferredUnit: z.ZodOptional<z.ZodString>;
113
+ definitionSource: z.ZodOptional<z.ZodString>;
114
+ }, z.core.$strip>>;
115
+ units: z.ZodArray<z.ZodObject<{
116
+ id: z.ZodString;
117
+ symbol: z.ZodString;
118
+ name: z.ZodOptional<z.ZodString>;
119
+ dimension: z.ZodRecord<z.ZodEnum<{
120
+ time: "time";
121
+ length: "length";
122
+ mass: "mass";
123
+ electricCurrent: "electricCurrent";
124
+ thermodynamicTemperature: "thermodynamicTemperature";
125
+ amountOfSubstance: "amountOfSubstance";
126
+ luminousIntensity: "luminousIntensity";
127
+ }> & z.core.$partial, z.ZodNumber>;
128
+ factorToSi: z.ZodObject<{
129
+ numerator: z.ZodString;
130
+ denominator: z.ZodString;
131
+ }, z.core.$strip>;
132
+ offsetToSi: z.ZodOptional<z.ZodObject<{
133
+ numerator: z.ZodString;
134
+ denominator: z.ZodString;
135
+ }, z.core.$strip>>;
136
+ context: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>>;
138
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
139
+ id: z.ZodString;
140
+ bases: z.ZodArray<z.ZodObject<{
141
+ unit: z.ZodString;
142
+ value: z.ZodObject<{
143
+ numerator: z.ZodString;
144
+ denominator: z.ZodString;
145
+ }, z.core.$strip>;
146
+ }, z.core.$strip>>;
147
+ }, z.core.$strip>>>;
148
+ }, z.core.$strip>>;
149
+ kind: z.ZodLiteral<"presentation">;
72
150
  metadata: z.ZodObject<{
73
151
  title: z.ZodOptional<z.ZodString>;
74
152
  author: z.ZodOptional<z.ZodString>;
@@ -79,6 +157,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
79
157
  createdIso: z.ZodOptional<z.ZodString>;
80
158
  modifiedIso: z.ZodOptional<z.ZodString>;
81
159
  }, z.core.$strip>;
160
+ }, z.core.$strip>, z.ZodObject<{
82
161
  sheets: z.ZodArray<z.ZodObject<{
83
162
  name: z.ZodString;
84
163
  cells: z.ZodArray<z.ZodObject<{
@@ -135,6 +214,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
135
214
  }, z.core.$strip>>;
136
215
  hyperlink: z.ZodOptional<z.ZodString>;
137
216
  sourcePath: z.ZodOptional<z.ZodString>;
217
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
218
+ pageIndex: z.ZodNumber;
219
+ xPt: z.ZodNumber;
220
+ yPt: z.ZodNumber;
221
+ widthPt: z.ZodNumber;
222
+ heightPt: z.ZodNumber;
223
+ }, z.core.$strip>>>;
138
224
  }, z.core.$strip>>>;
139
225
  colSpan: z.ZodOptional<z.ZodNumber>;
140
226
  rowSpan: z.ZodOptional<z.ZodNumber>;
@@ -212,7 +298,23 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
212
298
  bottom: "bottom";
213
299
  middle: "middle";
214
300
  }>>;
301
+ comment: z.ZodOptional<z.ZodObject<{
302
+ text: z.ZodString;
303
+ author: z.ZodOptional<z.ZodString>;
304
+ createdAt: z.ZodOptional<z.ZodString>;
305
+ replies: z.ZodOptional<z.ZodArray<z.ZodObject<{
306
+ text: z.ZodString;
307
+ author: z.ZodOptional<z.ZodString>;
308
+ }, z.core.$strip>>>;
309
+ }, z.core.$strip>>;
215
310
  sourcePath: z.ZodOptional<z.ZodString>;
311
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
312
+ pageIndex: z.ZodNumber;
313
+ xPt: z.ZodNumber;
314
+ yPt: z.ZodNumber;
315
+ widthPt: z.ZodNumber;
316
+ heightPt: z.ZodNumber;
317
+ }, z.core.$strip>>>;
216
318
  }, z.core.$strip>>;
217
319
  columns: z.ZodArray<z.ZodObject<{
218
320
  index: z.ZodNumber;
@@ -235,6 +337,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
235
337
  heightPt: z.ZodNumber;
236
338
  altText: z.ZodOptional<z.ZodString>;
237
339
  sourcePath: z.ZodOptional<z.ZodString>;
340
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
341
+ pageIndex: z.ZodNumber;
342
+ xPt: z.ZodNumber;
343
+ yPt: z.ZodNumber;
344
+ widthPt: z.ZodNumber;
345
+ heightPt: z.ZodNumber;
346
+ }, z.core.$strip>>>;
238
347
  anchorRow: z.ZodNumber;
239
348
  anchorColumn: z.ZodNumber;
240
349
  offsetXPt: z.ZodNumber;
@@ -283,9 +392,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
283
392
  }, z.core.$strip>;
284
393
  embeddedObjects: z.ZodOptional<z.ZodArray<z.ZodCustom<import("document-schema.js").ContentEmbeddedObject, import("document-schema.js").ContentEmbeddedObject>>>;
285
394
  }, z.core.$strip>>;
286
- }, z.core.$strip>, z.ZodObject<{
287
- kind: z.ZodLiteral<"drawing">;
288
- formatVersion: z.ZodLiteral<2>;
395
+ symbolTable: z.ZodOptional<z.ZodObject<{
396
+ symbols: z.ZodArray<z.ZodObject<{
397
+ glyph: z.ZodString;
398
+ scope: z.ZodString;
399
+ id: z.ZodString;
400
+ quantityKind: z.ZodOptional<z.ZodString>;
401
+ preferredUnit: z.ZodOptional<z.ZodString>;
402
+ definitionSource: z.ZodOptional<z.ZodString>;
403
+ }, z.core.$strip>>;
404
+ units: z.ZodArray<z.ZodObject<{
405
+ id: z.ZodString;
406
+ symbol: z.ZodString;
407
+ name: z.ZodOptional<z.ZodString>;
408
+ dimension: z.ZodRecord<z.ZodEnum<{
409
+ time: "time";
410
+ length: "length";
411
+ mass: "mass";
412
+ electricCurrent: "electricCurrent";
413
+ thermodynamicTemperature: "thermodynamicTemperature";
414
+ amountOfSubstance: "amountOfSubstance";
415
+ luminousIntensity: "luminousIntensity";
416
+ }> & z.core.$partial, z.ZodNumber>;
417
+ factorToSi: z.ZodObject<{
418
+ numerator: z.ZodString;
419
+ denominator: z.ZodString;
420
+ }, z.core.$strip>;
421
+ offsetToSi: z.ZodOptional<z.ZodObject<{
422
+ numerator: z.ZodString;
423
+ denominator: z.ZodString;
424
+ }, z.core.$strip>>;
425
+ context: z.ZodOptional<z.ZodString>;
426
+ }, z.core.$strip>>;
427
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
428
+ id: z.ZodString;
429
+ bases: z.ZodArray<z.ZodObject<{
430
+ unit: z.ZodString;
431
+ value: z.ZodObject<{
432
+ numerator: z.ZodString;
433
+ denominator: z.ZodString;
434
+ }, z.core.$strip>;
435
+ }, z.core.$strip>>;
436
+ }, z.core.$strip>>>;
437
+ }, z.core.$strip>>;
438
+ kind: z.ZodLiteral<"spreadsheet">;
289
439
  metadata: z.ZodObject<{
290
440
  title: z.ZodOptional<z.ZodString>;
291
441
  author: z.ZodOptional<z.ZodString>;
@@ -296,6 +446,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
296
446
  createdIso: z.ZodOptional<z.ZodString>;
297
447
  modifiedIso: z.ZodOptional<z.ZodString>;
298
448
  }, z.core.$strip>;
449
+ }, z.core.$strip>, z.ZodObject<{
299
450
  pages: z.ZodArray<z.ZodObject<{
300
451
  size: z.ZodObject<{
301
452
  widthPt: z.ZodNumber;
@@ -318,6 +469,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
318
469
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
319
470
  paintOrder: z.ZodOptional<z.ZodNumber>;
320
471
  sourcePath: z.ZodOptional<z.ZodString>;
472
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
473
+ pageIndex: z.ZodNumber;
474
+ xPt: z.ZodNumber;
475
+ yPt: z.ZodNumber;
476
+ widthPt: z.ZodNumber;
477
+ heightPt: z.ZodNumber;
478
+ }, z.core.$strip>>>;
321
479
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
322
480
  }, z.core.$strip>>;
323
481
  vectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -350,6 +508,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
350
508
  }, z.core.$strip>>;
351
509
  paintOrder: z.ZodOptional<z.ZodNumber>;
352
510
  sourcePath: z.ZodOptional<z.ZodString>;
511
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
512
+ pageIndex: z.ZodNumber;
513
+ xPt: z.ZodNumber;
514
+ yPt: z.ZodNumber;
515
+ widthPt: z.ZodNumber;
516
+ heightPt: z.ZodNumber;
517
+ }, z.core.$strip>>>;
353
518
  }, z.core.$strip>, z.ZodObject<{
354
519
  kind: z.ZodLiteral<"ellipse">;
355
520
  frame: z.ZodObject<{
@@ -380,6 +545,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
380
545
  }, z.core.$strip>>;
381
546
  paintOrder: z.ZodOptional<z.ZodNumber>;
382
547
  sourcePath: z.ZodOptional<z.ZodString>;
548
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
549
+ pageIndex: z.ZodNumber;
550
+ xPt: z.ZodNumber;
551
+ yPt: z.ZodNumber;
552
+ widthPt: z.ZodNumber;
553
+ heightPt: z.ZodNumber;
554
+ }, z.core.$strip>>>;
383
555
  }, z.core.$strip>, z.ZodObject<{
384
556
  kind: z.ZodLiteral<"line">;
385
557
  from: z.ZodObject<{
@@ -406,6 +578,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
406
578
  }, z.core.$strip>;
407
579
  paintOrder: z.ZodOptional<z.ZodNumber>;
408
580
  sourcePath: z.ZodOptional<z.ZodString>;
581
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
582
+ pageIndex: z.ZodNumber;
583
+ xPt: z.ZodNumber;
584
+ yPt: z.ZodNumber;
585
+ widthPt: z.ZodNumber;
586
+ heightPt: z.ZodNumber;
587
+ }, z.core.$strip>>>;
409
588
  }, z.core.$strip>, z.ZodObject<{
410
589
  kind: z.ZodLiteral<"path">;
411
590
  frame: z.ZodObject<{
@@ -468,11 +647,59 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
468
647
  }, z.core.$strip>>;
469
648
  paintOrder: z.ZodOptional<z.ZodNumber>;
470
649
  sourcePath: z.ZodOptional<z.ZodString>;
650
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
651
+ pageIndex: z.ZodNumber;
652
+ xPt: z.ZodNumber;
653
+ yPt: z.ZodNumber;
654
+ widthPt: z.ZodNumber;
655
+ heightPt: z.ZodNumber;
656
+ }, z.core.$strip>>>;
471
657
  }, z.core.$strip>], "kind">>;
472
658
  }, z.core.$strip>>;
473
- }, z.core.$strip>, z.ZodObject<{
474
- kind: z.ZodLiteral<"formula">;
475
- formatVersion: z.ZodLiteral<2>;
659
+ symbolTable: z.ZodOptional<z.ZodObject<{
660
+ symbols: z.ZodArray<z.ZodObject<{
661
+ glyph: z.ZodString;
662
+ scope: z.ZodString;
663
+ id: z.ZodString;
664
+ quantityKind: z.ZodOptional<z.ZodString>;
665
+ preferredUnit: z.ZodOptional<z.ZodString>;
666
+ definitionSource: z.ZodOptional<z.ZodString>;
667
+ }, z.core.$strip>>;
668
+ units: z.ZodArray<z.ZodObject<{
669
+ id: z.ZodString;
670
+ symbol: z.ZodString;
671
+ name: z.ZodOptional<z.ZodString>;
672
+ dimension: z.ZodRecord<z.ZodEnum<{
673
+ time: "time";
674
+ length: "length";
675
+ mass: "mass";
676
+ electricCurrent: "electricCurrent";
677
+ thermodynamicTemperature: "thermodynamicTemperature";
678
+ amountOfSubstance: "amountOfSubstance";
679
+ luminousIntensity: "luminousIntensity";
680
+ }> & z.core.$partial, z.ZodNumber>;
681
+ factorToSi: z.ZodObject<{
682
+ numerator: z.ZodString;
683
+ denominator: z.ZodString;
684
+ }, z.core.$strip>;
685
+ offsetToSi: z.ZodOptional<z.ZodObject<{
686
+ numerator: z.ZodString;
687
+ denominator: z.ZodString;
688
+ }, z.core.$strip>>;
689
+ context: z.ZodOptional<z.ZodString>;
690
+ }, z.core.$strip>>;
691
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
692
+ id: z.ZodString;
693
+ bases: z.ZodArray<z.ZodObject<{
694
+ unit: z.ZodString;
695
+ value: z.ZodObject<{
696
+ numerator: z.ZodString;
697
+ denominator: z.ZodString;
698
+ }, z.core.$strip>;
699
+ }, z.core.$strip>>;
700
+ }, z.core.$strip>>>;
701
+ }, z.core.$strip>>;
702
+ kind: z.ZodLiteral<"drawing">;
476
703
  metadata: z.ZodObject<{
477
704
  title: z.ZodOptional<z.ZodString>;
478
705
  author: z.ZodOptional<z.ZodString>;
@@ -483,9 +710,73 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
483
710
  createdIso: z.ZodOptional<z.ZodString>;
484
711
  modifiedIso: z.ZodOptional<z.ZodString>;
485
712
  }, z.core.$strip>;
713
+ }, z.core.$strip>, z.ZodObject<{
486
714
  formula: z.ZodObject<{
487
715
  mathml: z.ZodArray<z.ZodCustom<import("document-schema.js").MathMlNode, import("document-schema.js").MathMlNode>>;
488
716
  starMath: z.ZodOptional<z.ZodString>;
717
+ presentation: z.ZodOptional<z.ZodObject<{
718
+ latex: z.ZodString;
719
+ }, z.core.$strip>>;
720
+ content: z.ZodOptional<z.ZodCustom<import("document-schema.js").MathExpression, import("document-schema.js").MathExpression>>;
721
+ provenance: z.ZodOptional<z.ZodObject<{
722
+ source: z.ZodString;
723
+ pageRef: z.ZodOptional<z.ZodString>;
724
+ editTrail: z.ZodArray<z.ZodString>;
725
+ }, z.core.$strip>>;
726
+ }, z.core.$strip>;
727
+ symbolTable: z.ZodOptional<z.ZodObject<{
728
+ symbols: z.ZodArray<z.ZodObject<{
729
+ glyph: z.ZodString;
730
+ scope: z.ZodString;
731
+ id: z.ZodString;
732
+ quantityKind: z.ZodOptional<z.ZodString>;
733
+ preferredUnit: z.ZodOptional<z.ZodString>;
734
+ definitionSource: z.ZodOptional<z.ZodString>;
735
+ }, z.core.$strip>>;
736
+ units: z.ZodArray<z.ZodObject<{
737
+ id: z.ZodString;
738
+ symbol: z.ZodString;
739
+ name: z.ZodOptional<z.ZodString>;
740
+ dimension: z.ZodRecord<z.ZodEnum<{
741
+ time: "time";
742
+ length: "length";
743
+ mass: "mass";
744
+ electricCurrent: "electricCurrent";
745
+ thermodynamicTemperature: "thermodynamicTemperature";
746
+ amountOfSubstance: "amountOfSubstance";
747
+ luminousIntensity: "luminousIntensity";
748
+ }> & z.core.$partial, z.ZodNumber>;
749
+ factorToSi: z.ZodObject<{
750
+ numerator: z.ZodString;
751
+ denominator: z.ZodString;
752
+ }, z.core.$strip>;
753
+ offsetToSi: z.ZodOptional<z.ZodObject<{
754
+ numerator: z.ZodString;
755
+ denominator: z.ZodString;
756
+ }, z.core.$strip>>;
757
+ context: z.ZodOptional<z.ZodString>;
758
+ }, z.core.$strip>>;
759
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
760
+ id: z.ZodString;
761
+ bases: z.ZodArray<z.ZodObject<{
762
+ unit: z.ZodString;
763
+ value: z.ZodObject<{
764
+ numerator: z.ZodString;
765
+ denominator: z.ZodString;
766
+ }, z.core.$strip>;
767
+ }, z.core.$strip>>;
768
+ }, z.core.$strip>>>;
769
+ }, z.core.$strip>>;
770
+ kind: z.ZodLiteral<"formula">;
771
+ metadata: z.ZodObject<{
772
+ title: z.ZodOptional<z.ZodString>;
773
+ author: z.ZodOptional<z.ZodString>;
774
+ subject: z.ZodOptional<z.ZodString>;
775
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
776
+ creator: z.ZodOptional<z.ZodString>;
777
+ producer: z.ZodOptional<z.ZodString>;
778
+ createdIso: z.ZodOptional<z.ZodString>;
779
+ modifiedIso: z.ZodOptional<z.ZodString>;
489
780
  }, z.core.$strip>;
490
781
  }, z.core.$strip>], "kind">>;
491
782
  //#endregion
package/dist/codec.d.ts CHANGED
@@ -2,18 +2,6 @@ import { z } from "zod";
2
2
  //#region src/codec.d.ts
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
- kind: z.ZodLiteral<"wordprocessing">;
6
- formatVersion: z.ZodLiteral<2>;
7
- metadata: z.ZodObject<{
8
- title: z.ZodOptional<z.ZodString>;
9
- author: z.ZodOptional<z.ZodString>;
10
- subject: z.ZodOptional<z.ZodString>;
11
- keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
- creator: z.ZodOptional<z.ZodString>;
13
- producer: z.ZodOptional<z.ZodString>;
14
- createdIso: z.ZodOptional<z.ZodString>;
15
- modifiedIso: z.ZodOptional<z.ZodString>;
16
- }, z.core.$strip>;
17
5
  sections: z.ZodArray<z.ZodObject<{
18
6
  pageSize: z.ZodObject<{
19
7
  widthPt: z.ZodNumber;
@@ -27,9 +15,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
27
15
  }, z.core.$strip>;
28
16
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
29
17
  }, z.core.$strip>>;
30
- }, z.core.$strip>, z.ZodObject<{
31
- kind: z.ZodLiteral<"presentation">;
32
- formatVersion: z.ZodLiteral<2>;
18
+ symbolTable: z.ZodOptional<z.ZodObject<{
19
+ symbols: z.ZodArray<z.ZodObject<{
20
+ glyph: z.ZodString;
21
+ scope: z.ZodString;
22
+ id: z.ZodString;
23
+ quantityKind: z.ZodOptional<z.ZodString>;
24
+ preferredUnit: z.ZodOptional<z.ZodString>;
25
+ definitionSource: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>>;
27
+ units: z.ZodArray<z.ZodObject<{
28
+ id: z.ZodString;
29
+ symbol: z.ZodString;
30
+ name: z.ZodOptional<z.ZodString>;
31
+ dimension: z.ZodRecord<z.ZodEnum<{
32
+ time: "time";
33
+ length: "length";
34
+ mass: "mass";
35
+ electricCurrent: "electricCurrent";
36
+ thermodynamicTemperature: "thermodynamicTemperature";
37
+ amountOfSubstance: "amountOfSubstance";
38
+ luminousIntensity: "luminousIntensity";
39
+ }> & z.core.$partial, z.ZodNumber>;
40
+ factorToSi: z.ZodObject<{
41
+ numerator: z.ZodString;
42
+ denominator: z.ZodString;
43
+ }, z.core.$strip>;
44
+ offsetToSi: z.ZodOptional<z.ZodObject<{
45
+ numerator: z.ZodString;
46
+ denominator: z.ZodString;
47
+ }, z.core.$strip>>;
48
+ context: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>>;
50
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
+ id: z.ZodString;
52
+ bases: z.ZodArray<z.ZodObject<{
53
+ unit: z.ZodString;
54
+ value: z.ZodObject<{
55
+ numerator: z.ZodString;
56
+ denominator: z.ZodString;
57
+ }, z.core.$strip>;
58
+ }, z.core.$strip>>;
59
+ }, z.core.$strip>>>;
60
+ }, z.core.$strip>>;
61
+ kind: z.ZodLiteral<"wordprocessing">;
33
62
  metadata: z.ZodObject<{
34
63
  title: z.ZodOptional<z.ZodString>;
35
64
  author: z.ZodOptional<z.ZodString>;
@@ -40,6 +69,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
40
69
  createdIso: z.ZodOptional<z.ZodString>;
41
70
  modifiedIso: z.ZodOptional<z.ZodString>;
42
71
  }, z.core.$strip>;
72
+ }, z.core.$strip>, z.ZodObject<{
43
73
  slides: z.ZodArray<z.ZodObject<{
44
74
  size: z.ZodObject<{
45
75
  widthPt: z.ZodNumber;
@@ -62,13 +92,61 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
62
92
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
63
93
  paintOrder: z.ZodOptional<z.ZodNumber>;
64
94
  sourcePath: z.ZodOptional<z.ZodString>;
95
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
96
+ pageIndex: z.ZodNumber;
97
+ xPt: z.ZodNumber;
98
+ yPt: z.ZodNumber;
99
+ widthPt: z.ZodNumber;
100
+ heightPt: z.ZodNumber;
101
+ }, z.core.$strip>>>;
65
102
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
66
103
  }, z.core.$strip>>;
67
104
  notes: z.ZodString;
68
105
  }, z.core.$strip>>;
69
- }, z.core.$strip>, z.ZodObject<{
70
- kind: z.ZodLiteral<"spreadsheet">;
71
- formatVersion: z.ZodLiteral<2>;
106
+ symbolTable: z.ZodOptional<z.ZodObject<{
107
+ symbols: z.ZodArray<z.ZodObject<{
108
+ glyph: z.ZodString;
109
+ scope: z.ZodString;
110
+ id: z.ZodString;
111
+ quantityKind: z.ZodOptional<z.ZodString>;
112
+ preferredUnit: z.ZodOptional<z.ZodString>;
113
+ definitionSource: z.ZodOptional<z.ZodString>;
114
+ }, z.core.$strip>>;
115
+ units: z.ZodArray<z.ZodObject<{
116
+ id: z.ZodString;
117
+ symbol: z.ZodString;
118
+ name: z.ZodOptional<z.ZodString>;
119
+ dimension: z.ZodRecord<z.ZodEnum<{
120
+ time: "time";
121
+ length: "length";
122
+ mass: "mass";
123
+ electricCurrent: "electricCurrent";
124
+ thermodynamicTemperature: "thermodynamicTemperature";
125
+ amountOfSubstance: "amountOfSubstance";
126
+ luminousIntensity: "luminousIntensity";
127
+ }> & z.core.$partial, z.ZodNumber>;
128
+ factorToSi: z.ZodObject<{
129
+ numerator: z.ZodString;
130
+ denominator: z.ZodString;
131
+ }, z.core.$strip>;
132
+ offsetToSi: z.ZodOptional<z.ZodObject<{
133
+ numerator: z.ZodString;
134
+ denominator: z.ZodString;
135
+ }, z.core.$strip>>;
136
+ context: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>>;
138
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
139
+ id: z.ZodString;
140
+ bases: z.ZodArray<z.ZodObject<{
141
+ unit: z.ZodString;
142
+ value: z.ZodObject<{
143
+ numerator: z.ZodString;
144
+ denominator: z.ZodString;
145
+ }, z.core.$strip>;
146
+ }, z.core.$strip>>;
147
+ }, z.core.$strip>>>;
148
+ }, z.core.$strip>>;
149
+ kind: z.ZodLiteral<"presentation">;
72
150
  metadata: z.ZodObject<{
73
151
  title: z.ZodOptional<z.ZodString>;
74
152
  author: z.ZodOptional<z.ZodString>;
@@ -79,6 +157,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
79
157
  createdIso: z.ZodOptional<z.ZodString>;
80
158
  modifiedIso: z.ZodOptional<z.ZodString>;
81
159
  }, z.core.$strip>;
160
+ }, z.core.$strip>, z.ZodObject<{
82
161
  sheets: z.ZodArray<z.ZodObject<{
83
162
  name: z.ZodString;
84
163
  cells: z.ZodArray<z.ZodObject<{
@@ -135,6 +214,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
135
214
  }, z.core.$strip>>;
136
215
  hyperlink: z.ZodOptional<z.ZodString>;
137
216
  sourcePath: z.ZodOptional<z.ZodString>;
217
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
218
+ pageIndex: z.ZodNumber;
219
+ xPt: z.ZodNumber;
220
+ yPt: z.ZodNumber;
221
+ widthPt: z.ZodNumber;
222
+ heightPt: z.ZodNumber;
223
+ }, z.core.$strip>>>;
138
224
  }, z.core.$strip>>>;
139
225
  colSpan: z.ZodOptional<z.ZodNumber>;
140
226
  rowSpan: z.ZodOptional<z.ZodNumber>;
@@ -212,7 +298,23 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
212
298
  bottom: "bottom";
213
299
  middle: "middle";
214
300
  }>>;
301
+ comment: z.ZodOptional<z.ZodObject<{
302
+ text: z.ZodString;
303
+ author: z.ZodOptional<z.ZodString>;
304
+ createdAt: z.ZodOptional<z.ZodString>;
305
+ replies: z.ZodOptional<z.ZodArray<z.ZodObject<{
306
+ text: z.ZodString;
307
+ author: z.ZodOptional<z.ZodString>;
308
+ }, z.core.$strip>>>;
309
+ }, z.core.$strip>>;
215
310
  sourcePath: z.ZodOptional<z.ZodString>;
311
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
312
+ pageIndex: z.ZodNumber;
313
+ xPt: z.ZodNumber;
314
+ yPt: z.ZodNumber;
315
+ widthPt: z.ZodNumber;
316
+ heightPt: z.ZodNumber;
317
+ }, z.core.$strip>>>;
216
318
  }, z.core.$strip>>;
217
319
  columns: z.ZodArray<z.ZodObject<{
218
320
  index: z.ZodNumber;
@@ -235,6 +337,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
235
337
  heightPt: z.ZodNumber;
236
338
  altText: z.ZodOptional<z.ZodString>;
237
339
  sourcePath: z.ZodOptional<z.ZodString>;
340
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
341
+ pageIndex: z.ZodNumber;
342
+ xPt: z.ZodNumber;
343
+ yPt: z.ZodNumber;
344
+ widthPt: z.ZodNumber;
345
+ heightPt: z.ZodNumber;
346
+ }, z.core.$strip>>>;
238
347
  anchorRow: z.ZodNumber;
239
348
  anchorColumn: z.ZodNumber;
240
349
  offsetXPt: z.ZodNumber;
@@ -283,9 +392,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
283
392
  }, z.core.$strip>;
284
393
  embeddedObjects: z.ZodOptional<z.ZodArray<z.ZodCustom<import("document-schema.js").ContentEmbeddedObject, import("document-schema.js").ContentEmbeddedObject>>>;
285
394
  }, z.core.$strip>>;
286
- }, z.core.$strip>, z.ZodObject<{
287
- kind: z.ZodLiteral<"drawing">;
288
- formatVersion: z.ZodLiteral<2>;
395
+ symbolTable: z.ZodOptional<z.ZodObject<{
396
+ symbols: z.ZodArray<z.ZodObject<{
397
+ glyph: z.ZodString;
398
+ scope: z.ZodString;
399
+ id: z.ZodString;
400
+ quantityKind: z.ZodOptional<z.ZodString>;
401
+ preferredUnit: z.ZodOptional<z.ZodString>;
402
+ definitionSource: z.ZodOptional<z.ZodString>;
403
+ }, z.core.$strip>>;
404
+ units: z.ZodArray<z.ZodObject<{
405
+ id: z.ZodString;
406
+ symbol: z.ZodString;
407
+ name: z.ZodOptional<z.ZodString>;
408
+ dimension: z.ZodRecord<z.ZodEnum<{
409
+ time: "time";
410
+ length: "length";
411
+ mass: "mass";
412
+ electricCurrent: "electricCurrent";
413
+ thermodynamicTemperature: "thermodynamicTemperature";
414
+ amountOfSubstance: "amountOfSubstance";
415
+ luminousIntensity: "luminousIntensity";
416
+ }> & z.core.$partial, z.ZodNumber>;
417
+ factorToSi: z.ZodObject<{
418
+ numerator: z.ZodString;
419
+ denominator: z.ZodString;
420
+ }, z.core.$strip>;
421
+ offsetToSi: z.ZodOptional<z.ZodObject<{
422
+ numerator: z.ZodString;
423
+ denominator: z.ZodString;
424
+ }, z.core.$strip>>;
425
+ context: z.ZodOptional<z.ZodString>;
426
+ }, z.core.$strip>>;
427
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
428
+ id: z.ZodString;
429
+ bases: z.ZodArray<z.ZodObject<{
430
+ unit: z.ZodString;
431
+ value: z.ZodObject<{
432
+ numerator: z.ZodString;
433
+ denominator: z.ZodString;
434
+ }, z.core.$strip>;
435
+ }, z.core.$strip>>;
436
+ }, z.core.$strip>>>;
437
+ }, z.core.$strip>>;
438
+ kind: z.ZodLiteral<"spreadsheet">;
289
439
  metadata: z.ZodObject<{
290
440
  title: z.ZodOptional<z.ZodString>;
291
441
  author: z.ZodOptional<z.ZodString>;
@@ -296,6 +446,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
296
446
  createdIso: z.ZodOptional<z.ZodString>;
297
447
  modifiedIso: z.ZodOptional<z.ZodString>;
298
448
  }, z.core.$strip>;
449
+ }, z.core.$strip>, z.ZodObject<{
299
450
  pages: z.ZodArray<z.ZodObject<{
300
451
  size: z.ZodObject<{
301
452
  widthPt: z.ZodNumber;
@@ -318,6 +469,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
318
469
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
319
470
  paintOrder: z.ZodOptional<z.ZodNumber>;
320
471
  sourcePath: z.ZodOptional<z.ZodString>;
472
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
473
+ pageIndex: z.ZodNumber;
474
+ xPt: z.ZodNumber;
475
+ yPt: z.ZodNumber;
476
+ widthPt: z.ZodNumber;
477
+ heightPt: z.ZodNumber;
478
+ }, z.core.$strip>>>;
321
479
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
322
480
  }, z.core.$strip>>;
323
481
  vectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -350,6 +508,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
350
508
  }, z.core.$strip>>;
351
509
  paintOrder: z.ZodOptional<z.ZodNumber>;
352
510
  sourcePath: z.ZodOptional<z.ZodString>;
511
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
512
+ pageIndex: z.ZodNumber;
513
+ xPt: z.ZodNumber;
514
+ yPt: z.ZodNumber;
515
+ widthPt: z.ZodNumber;
516
+ heightPt: z.ZodNumber;
517
+ }, z.core.$strip>>>;
353
518
  }, z.core.$strip>, z.ZodObject<{
354
519
  kind: z.ZodLiteral<"ellipse">;
355
520
  frame: z.ZodObject<{
@@ -380,6 +545,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
380
545
  }, z.core.$strip>>;
381
546
  paintOrder: z.ZodOptional<z.ZodNumber>;
382
547
  sourcePath: z.ZodOptional<z.ZodString>;
548
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
549
+ pageIndex: z.ZodNumber;
550
+ xPt: z.ZodNumber;
551
+ yPt: z.ZodNumber;
552
+ widthPt: z.ZodNumber;
553
+ heightPt: z.ZodNumber;
554
+ }, z.core.$strip>>>;
383
555
  }, z.core.$strip>, z.ZodObject<{
384
556
  kind: z.ZodLiteral<"line">;
385
557
  from: z.ZodObject<{
@@ -406,6 +578,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
406
578
  }, z.core.$strip>;
407
579
  paintOrder: z.ZodOptional<z.ZodNumber>;
408
580
  sourcePath: z.ZodOptional<z.ZodString>;
581
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
582
+ pageIndex: z.ZodNumber;
583
+ xPt: z.ZodNumber;
584
+ yPt: z.ZodNumber;
585
+ widthPt: z.ZodNumber;
586
+ heightPt: z.ZodNumber;
587
+ }, z.core.$strip>>>;
409
588
  }, z.core.$strip>, z.ZodObject<{
410
589
  kind: z.ZodLiteral<"path">;
411
590
  frame: z.ZodObject<{
@@ -468,11 +647,59 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
468
647
  }, z.core.$strip>>;
469
648
  paintOrder: z.ZodOptional<z.ZodNumber>;
470
649
  sourcePath: z.ZodOptional<z.ZodString>;
650
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
651
+ pageIndex: z.ZodNumber;
652
+ xPt: z.ZodNumber;
653
+ yPt: z.ZodNumber;
654
+ widthPt: z.ZodNumber;
655
+ heightPt: z.ZodNumber;
656
+ }, z.core.$strip>>>;
471
657
  }, z.core.$strip>], "kind">>;
472
658
  }, z.core.$strip>>;
473
- }, z.core.$strip>, z.ZodObject<{
474
- kind: z.ZodLiteral<"formula">;
475
- formatVersion: z.ZodLiteral<2>;
659
+ symbolTable: z.ZodOptional<z.ZodObject<{
660
+ symbols: z.ZodArray<z.ZodObject<{
661
+ glyph: z.ZodString;
662
+ scope: z.ZodString;
663
+ id: z.ZodString;
664
+ quantityKind: z.ZodOptional<z.ZodString>;
665
+ preferredUnit: z.ZodOptional<z.ZodString>;
666
+ definitionSource: z.ZodOptional<z.ZodString>;
667
+ }, z.core.$strip>>;
668
+ units: z.ZodArray<z.ZodObject<{
669
+ id: z.ZodString;
670
+ symbol: z.ZodString;
671
+ name: z.ZodOptional<z.ZodString>;
672
+ dimension: z.ZodRecord<z.ZodEnum<{
673
+ time: "time";
674
+ length: "length";
675
+ mass: "mass";
676
+ electricCurrent: "electricCurrent";
677
+ thermodynamicTemperature: "thermodynamicTemperature";
678
+ amountOfSubstance: "amountOfSubstance";
679
+ luminousIntensity: "luminousIntensity";
680
+ }> & z.core.$partial, z.ZodNumber>;
681
+ factorToSi: z.ZodObject<{
682
+ numerator: z.ZodString;
683
+ denominator: z.ZodString;
684
+ }, z.core.$strip>;
685
+ offsetToSi: z.ZodOptional<z.ZodObject<{
686
+ numerator: z.ZodString;
687
+ denominator: z.ZodString;
688
+ }, z.core.$strip>>;
689
+ context: z.ZodOptional<z.ZodString>;
690
+ }, z.core.$strip>>;
691
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
692
+ id: z.ZodString;
693
+ bases: z.ZodArray<z.ZodObject<{
694
+ unit: z.ZodString;
695
+ value: z.ZodObject<{
696
+ numerator: z.ZodString;
697
+ denominator: z.ZodString;
698
+ }, z.core.$strip>;
699
+ }, z.core.$strip>>;
700
+ }, z.core.$strip>>>;
701
+ }, z.core.$strip>>;
702
+ kind: z.ZodLiteral<"drawing">;
476
703
  metadata: z.ZodObject<{
477
704
  title: z.ZodOptional<z.ZodString>;
478
705
  author: z.ZodOptional<z.ZodString>;
@@ -483,9 +710,73 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
483
710
  createdIso: z.ZodOptional<z.ZodString>;
484
711
  modifiedIso: z.ZodOptional<z.ZodString>;
485
712
  }, z.core.$strip>;
713
+ }, z.core.$strip>, z.ZodObject<{
486
714
  formula: z.ZodObject<{
487
715
  mathml: z.ZodArray<z.ZodCustom<import("document-schema.js").MathMlNode, import("document-schema.js").MathMlNode>>;
488
716
  starMath: z.ZodOptional<z.ZodString>;
717
+ presentation: z.ZodOptional<z.ZodObject<{
718
+ latex: z.ZodString;
719
+ }, z.core.$strip>>;
720
+ content: z.ZodOptional<z.ZodCustom<import("document-schema.js").MathExpression, import("document-schema.js").MathExpression>>;
721
+ provenance: z.ZodOptional<z.ZodObject<{
722
+ source: z.ZodString;
723
+ pageRef: z.ZodOptional<z.ZodString>;
724
+ editTrail: z.ZodArray<z.ZodString>;
725
+ }, z.core.$strip>>;
726
+ }, z.core.$strip>;
727
+ symbolTable: z.ZodOptional<z.ZodObject<{
728
+ symbols: z.ZodArray<z.ZodObject<{
729
+ glyph: z.ZodString;
730
+ scope: z.ZodString;
731
+ id: z.ZodString;
732
+ quantityKind: z.ZodOptional<z.ZodString>;
733
+ preferredUnit: z.ZodOptional<z.ZodString>;
734
+ definitionSource: z.ZodOptional<z.ZodString>;
735
+ }, z.core.$strip>>;
736
+ units: z.ZodArray<z.ZodObject<{
737
+ id: z.ZodString;
738
+ symbol: z.ZodString;
739
+ name: z.ZodOptional<z.ZodString>;
740
+ dimension: z.ZodRecord<z.ZodEnum<{
741
+ time: "time";
742
+ length: "length";
743
+ mass: "mass";
744
+ electricCurrent: "electricCurrent";
745
+ thermodynamicTemperature: "thermodynamicTemperature";
746
+ amountOfSubstance: "amountOfSubstance";
747
+ luminousIntensity: "luminousIntensity";
748
+ }> & z.core.$partial, z.ZodNumber>;
749
+ factorToSi: z.ZodObject<{
750
+ numerator: z.ZodString;
751
+ denominator: z.ZodString;
752
+ }, z.core.$strip>;
753
+ offsetToSi: z.ZodOptional<z.ZodObject<{
754
+ numerator: z.ZodString;
755
+ denominator: z.ZodString;
756
+ }, z.core.$strip>>;
757
+ context: z.ZodOptional<z.ZodString>;
758
+ }, z.core.$strip>>;
759
+ contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
760
+ id: z.ZodString;
761
+ bases: z.ZodArray<z.ZodObject<{
762
+ unit: z.ZodString;
763
+ value: z.ZodObject<{
764
+ numerator: z.ZodString;
765
+ denominator: z.ZodString;
766
+ }, z.core.$strip>;
767
+ }, z.core.$strip>>;
768
+ }, z.core.$strip>>>;
769
+ }, z.core.$strip>>;
770
+ kind: z.ZodLiteral<"formula">;
771
+ metadata: z.ZodObject<{
772
+ title: z.ZodOptional<z.ZodString>;
773
+ author: z.ZodOptional<z.ZodString>;
774
+ subject: z.ZodOptional<z.ZodString>;
775
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
776
+ creator: z.ZodOptional<z.ZodString>;
777
+ producer: z.ZodOptional<z.ZodString>;
778
+ createdIso: z.ZodOptional<z.ZodString>;
779
+ modifiedIso: z.ZodOptional<z.ZodString>;
489
780
  }, z.core.$strip>;
490
781
  }, z.core.$strip>], "kind">>;
491
782
  //#endregion
@@ -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
- let level = headingLevel;
60
- if (level > 6) {
61
- context.sink({
62
- code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.HEADING_LEVEL_CLAMPED,
63
- severity: "info",
64
- message: `heading level ${String(level)} exceeds ATX's own six-"#" ceiling and is clamped to ${String(6)}`
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}`;
@@ -96,6 +94,17 @@ function renderTopLevelBlock(block, context) {
96
94
  }
97
95
  }
98
96
  function listInfoFor(numId, context) {
97
+ if (numId === void 0) {
98
+ if (!context.reportedAbsentNumIdFallback) {
99
+ context.reportedAbsentNumIdFallback = true;
100
+ context.sink({
101
+ code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.LIST_NUMID_FALLBACK,
102
+ severity: "info",
103
+ message: "a list membership with no numId of its own (a depth-only ContentListMembership) has no marker type, task-ness, or loose-ness to recover and falls back to an ordinary, tight, non-task bullet list"
104
+ });
105
+ }
106
+ return;
107
+ }
99
108
  const info = require_shared_list_id.parseListNumId(numId);
100
109
  if (info === void 0 && !context.reportedFallbackNumIds.has(numId)) {
101
110
  context.reportedFallbackNumIds.add(numId);
@@ -130,7 +139,7 @@ function stripCheckboxRun(item, checkboxPrefix) {
130
139
  }
131
140
  function renderListItemMarker(numId, info, item, context) {
132
141
  const checkboxText = (info?.task === true ? checkboxPrefixFor(item) : void 0) ?? "";
133
- if (info?.type === "ordered") {
142
+ if (info?.type === "ordered" && numId !== void 0) {
134
143
  const next = context.orderedCounters.get(numId) ?? info.start ?? 1;
135
144
  context.orderedCounters.set(numId, next + 1);
136
145
  const bare = `${String(next)}${context.orderedDelimiter} `;
@@ -177,7 +186,7 @@ function renderListRegion(items, context) {
177
186
  if (partIndex > 0) {
178
187
  const previous = parts[partIndex - 1];
179
188
  const sameList = previous.numId === part.numId;
180
- const loose = sameList && (require_shared_list_id.parseListNumId(previous.numId)?.loose ?? false);
189
+ const loose = sameList && previous.numId !== void 0 && (require_shared_list_id.parseListNumId(previous.numId)?.loose ?? false);
181
190
  out += sameList && !loose ? "\n" : "\n\n";
182
191
  }
183
192
  out += part.text;
@@ -219,7 +228,8 @@ function emitMarkdown(document, options = {}) {
219
228
  headingStyle: options.headingStyle ?? "atx",
220
229
  embedImages: options.images ?? true,
221
230
  orderedCounters: /* @__PURE__ */ new Map(),
222
- reportedFallbackNumIds: /* @__PURE__ */ new Set()
231
+ reportedFallbackNumIds: /* @__PURE__ */ new Set(),
232
+ reportedAbsentNumIdFallback: false
223
233
  };
224
234
  const body = document.sections.map((section) => emitBlocks(section.blocks, context)).join("\n\n");
225
235
  const frontMatter = options.frontMatter === true ? require_emit_front_matter.emitFrontMatter(document.metadata) : void 0;
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
- let level = headingLevel;
59
- if (level > 6) {
60
- context.sink({
61
- code: MarkdownDiagnosticCodes.HEADING_LEVEL_CLAMPED,
62
- severity: "info",
63
- message: `heading level ${String(level)} exceeds ATX's own six-"#" ceiling and is clamped to ${String(6)}`
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}`;
@@ -95,6 +93,17 @@ function renderTopLevelBlock(block, context) {
95
93
  }
96
94
  }
97
95
  function listInfoFor(numId, context) {
96
+ if (numId === void 0) {
97
+ if (!context.reportedAbsentNumIdFallback) {
98
+ context.reportedAbsentNumIdFallback = true;
99
+ context.sink({
100
+ code: MarkdownDiagnosticCodes.LIST_NUMID_FALLBACK,
101
+ severity: "info",
102
+ message: "a list membership with no numId of its own (a depth-only ContentListMembership) has no marker type, task-ness, or loose-ness to recover and falls back to an ordinary, tight, non-task bullet list"
103
+ });
104
+ }
105
+ return;
106
+ }
98
107
  const info = parseListNumId(numId);
99
108
  if (info === void 0 && !context.reportedFallbackNumIds.has(numId)) {
100
109
  context.reportedFallbackNumIds.add(numId);
@@ -129,7 +138,7 @@ function stripCheckboxRun(item, checkboxPrefix) {
129
138
  }
130
139
  function renderListItemMarker(numId, info, item, context) {
131
140
  const checkboxText = (info?.task === true ? checkboxPrefixFor(item) : void 0) ?? "";
132
- if (info?.type === "ordered") {
141
+ if (info?.type === "ordered" && numId !== void 0) {
133
142
  const next = context.orderedCounters.get(numId) ?? info.start ?? 1;
134
143
  context.orderedCounters.set(numId, next + 1);
135
144
  const bare = `${String(next)}${context.orderedDelimiter} `;
@@ -176,7 +185,7 @@ function renderListRegion(items, context) {
176
185
  if (partIndex > 0) {
177
186
  const previous = parts[partIndex - 1];
178
187
  const sameList = previous.numId === part.numId;
179
- const loose = sameList && (parseListNumId(previous.numId)?.loose ?? false);
188
+ const loose = sameList && previous.numId !== void 0 && (parseListNumId(previous.numId)?.loose ?? false);
180
189
  out += sameList && !loose ? "\n" : "\n\n";
181
190
  }
182
191
  out += part.text;
@@ -218,7 +227,8 @@ function emitMarkdown(document, options = {}) {
218
227
  headingStyle: options.headingStyle ?? "atx",
219
228
  embedImages: options.images ?? true,
220
229
  orderedCounters: /* @__PURE__ */ new Map(),
221
- reportedFallbackNumIds: /* @__PURE__ */ new Set()
230
+ reportedFallbackNumIds: /* @__PURE__ */ new Set(),
231
+ reportedAbsentNumIdFallback: false
222
232
  };
223
233
  const body = document.sections.map((section) => emitBlocks(section.blocks, context)).join("\n\n");
224
234
  const frontMatter = options.frontMatter === true ? emitFrontMatter(document.metadata) : void 0;
@@ -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) {
@@ -270,15 +271,13 @@ function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
270
271
  quoteDepth: 0,
271
272
  list: void 0
272
273
  };
273
- const blocks = parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt));
274
274
  return {
275
275
  kind: "wordprocessing",
276
- formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
277
276
  metadata,
278
277
  sections: [{
279
278
  pageSize,
280
279
  margins,
281
- blocks
280
+ blocks: parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt))
282
281
  }]
283
282
  };
284
283
  }
@@ -7,7 +7,7 @@ import { extractFrontMatter } from "./front-matter.js";
7
7
  import { resolveMarkdownImage } from "./image.js";
8
8
  import { lowerCodeBlockRun, lowerInlineNodes } from "./inline.js";
9
9
  import { lowerTable } from "./table.js";
10
- import { CONTENT_FORMAT_VERSION, PAGE_SIZE_A4 } from "document-schema.js";
10
+ import { PAGE_SIZE_A4 } from "document-schema.js";
11
11
  //#region src/lower/lower.ts
12
12
  function inlineContext(context) {
13
13
  return {
@@ -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) {
@@ -269,15 +270,13 @@ function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
269
270
  quoteDepth: 0,
270
271
  list: void 0
271
272
  };
272
- const blocks = parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt));
273
273
  return {
274
274
  kind: "wordprocessing",
275
- formatVersion: CONTENT_FORMAT_VERSION,
276
275
  metadata,
277
276
  sections: [{
278
277
  pageSize,
279
278
  margins,
280
- blocks
279
+ blocks: parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt))
281
280
  }]
282
281
  };
283
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-codec",
3
- "version": "1.4.2",
3
+ "version": "3.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": "^2.7.17",
82
+ "document-schema.js": "^4.0.0",
83
83
  "zod": "^4.4.3"
84
84
  },
85
85
  "devDependencies": {