markdown-codec 2.0.0 → 3.0.1

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
@@ -171,7 +171,7 @@ Every construct `src/lower`/`src/emit` cannot represent losslessly is a document
171
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<3>;
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<3>;
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;
@@ -73,9 +103,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
73
103
  }, z.core.$strip>>;
74
104
  notes: z.ZodString;
75
105
  }, z.core.$strip>>;
76
- }, z.core.$strip>, z.ZodObject<{
77
- kind: z.ZodLiteral<"spreadsheet">;
78
- formatVersion: z.ZodLiteral<3>;
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">;
79
150
  metadata: z.ZodObject<{
80
151
  title: z.ZodOptional<z.ZodString>;
81
152
  author: z.ZodOptional<z.ZodString>;
@@ -86,6 +157,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
86
157
  createdIso: z.ZodOptional<z.ZodString>;
87
158
  modifiedIso: z.ZodOptional<z.ZodString>;
88
159
  }, z.core.$strip>;
160
+ }, z.core.$strip>, z.ZodObject<{
89
161
  sheets: z.ZodArray<z.ZodObject<{
90
162
  name: z.ZodString;
91
163
  cells: z.ZodArray<z.ZodObject<{
@@ -320,9 +392,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
320
392
  }, z.core.$strip>;
321
393
  embeddedObjects: z.ZodOptional<z.ZodArray<z.ZodCustom<import("document-schema.js").ContentEmbeddedObject, import("document-schema.js").ContentEmbeddedObject>>>;
322
394
  }, z.core.$strip>>;
323
- }, z.core.$strip>, z.ZodObject<{
324
- kind: z.ZodLiteral<"drawing">;
325
- formatVersion: z.ZodLiteral<3>;
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">;
326
439
  metadata: z.ZodObject<{
327
440
  title: z.ZodOptional<z.ZodString>;
328
441
  author: z.ZodOptional<z.ZodString>;
@@ -333,6 +446,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
333
446
  createdIso: z.ZodOptional<z.ZodString>;
334
447
  modifiedIso: z.ZodOptional<z.ZodString>;
335
448
  }, z.core.$strip>;
449
+ }, z.core.$strip>, z.ZodObject<{
336
450
  pages: z.ZodArray<z.ZodObject<{
337
451
  size: z.ZodObject<{
338
452
  widthPt: z.ZodNumber;
@@ -542,9 +656,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
542
656
  }, z.core.$strip>>>;
543
657
  }, z.core.$strip>], "kind">>;
544
658
  }, z.core.$strip>>;
545
- }, z.core.$strip>, z.ZodObject<{
546
- kind: z.ZodLiteral<"formula">;
547
- formatVersion: z.ZodLiteral<3>;
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">;
548
703
  metadata: z.ZodObject<{
549
704
  title: z.ZodOptional<z.ZodString>;
550
705
  author: z.ZodOptional<z.ZodString>;
@@ -555,9 +710,73 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
555
710
  createdIso: z.ZodOptional<z.ZodString>;
556
711
  modifiedIso: z.ZodOptional<z.ZodString>;
557
712
  }, z.core.$strip>;
713
+ }, z.core.$strip>, z.ZodObject<{
558
714
  formula: z.ZodObject<{
559
715
  mathml: z.ZodArray<z.ZodCustom<import("document-schema.js").MathMlNode, import("document-schema.js").MathMlNode>>;
560
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>;
561
780
  }, z.core.$strip>;
562
781
  }, z.core.$strip>], "kind">>;
563
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<3>;
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<3>;
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;
@@ -73,9 +103,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
73
103
  }, z.core.$strip>>;
74
104
  notes: z.ZodString;
75
105
  }, z.core.$strip>>;
76
- }, z.core.$strip>, z.ZodObject<{
77
- kind: z.ZodLiteral<"spreadsheet">;
78
- formatVersion: z.ZodLiteral<3>;
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">;
79
150
  metadata: z.ZodObject<{
80
151
  title: z.ZodOptional<z.ZodString>;
81
152
  author: z.ZodOptional<z.ZodString>;
@@ -86,6 +157,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
86
157
  createdIso: z.ZodOptional<z.ZodString>;
87
158
  modifiedIso: z.ZodOptional<z.ZodString>;
88
159
  }, z.core.$strip>;
160
+ }, z.core.$strip>, z.ZodObject<{
89
161
  sheets: z.ZodArray<z.ZodObject<{
90
162
  name: z.ZodString;
91
163
  cells: z.ZodArray<z.ZodObject<{
@@ -320,9 +392,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
320
392
  }, z.core.$strip>;
321
393
  embeddedObjects: z.ZodOptional<z.ZodArray<z.ZodCustom<import("document-schema.js").ContentEmbeddedObject, import("document-schema.js").ContentEmbeddedObject>>>;
322
394
  }, z.core.$strip>>;
323
- }, z.core.$strip>, z.ZodObject<{
324
- kind: z.ZodLiteral<"drawing">;
325
- formatVersion: z.ZodLiteral<3>;
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">;
326
439
  metadata: z.ZodObject<{
327
440
  title: z.ZodOptional<z.ZodString>;
328
441
  author: z.ZodOptional<z.ZodString>;
@@ -333,6 +446,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
333
446
  createdIso: z.ZodOptional<z.ZodString>;
334
447
  modifiedIso: z.ZodOptional<z.ZodString>;
335
448
  }, z.core.$strip>;
449
+ }, z.core.$strip>, z.ZodObject<{
336
450
  pages: z.ZodArray<z.ZodObject<{
337
451
  size: z.ZodObject<{
338
452
  widthPt: z.ZodNumber;
@@ -542,9 +656,50 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
542
656
  }, z.core.$strip>>>;
543
657
  }, z.core.$strip>], "kind">>;
544
658
  }, z.core.$strip>>;
545
- }, z.core.$strip>, z.ZodObject<{
546
- kind: z.ZodLiteral<"formula">;
547
- formatVersion: z.ZodLiteral<3>;
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">;
548
703
  metadata: z.ZodObject<{
549
704
  title: z.ZodOptional<z.ZodString>;
550
705
  author: z.ZodOptional<z.ZodString>;
@@ -555,9 +710,73 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
555
710
  createdIso: z.ZodOptional<z.ZodString>;
556
711
  modifiedIso: z.ZodOptional<z.ZodString>;
557
712
  }, z.core.$strip>;
713
+ }, z.core.$strip>, z.ZodObject<{
558
714
  formula: z.ZodObject<{
559
715
  mathml: z.ZodArray<z.ZodCustom<import("document-schema.js").MathMlNode, import("document-schema.js").MathMlNode>>;
560
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>;
561
780
  }, z.core.$strip>;
562
781
  }, z.core.$strip>], "kind">>;
563
782
  //#endregion
@@ -94,6 +94,17 @@ function renderTopLevelBlock(block, context) {
94
94
  }
95
95
  }
96
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
+ }
97
108
  const info = require_shared_list_id.parseListNumId(numId);
98
109
  if (info === void 0 && !context.reportedFallbackNumIds.has(numId)) {
99
110
  context.reportedFallbackNumIds.add(numId);
@@ -128,7 +139,7 @@ function stripCheckboxRun(item, checkboxPrefix) {
128
139
  }
129
140
  function renderListItemMarker(numId, info, item, context) {
130
141
  const checkboxText = (info?.task === true ? checkboxPrefixFor(item) : void 0) ?? "";
131
- if (info?.type === "ordered") {
142
+ if (info?.type === "ordered" && numId !== void 0) {
132
143
  const next = context.orderedCounters.get(numId) ?? info.start ?? 1;
133
144
  context.orderedCounters.set(numId, next + 1);
134
145
  const bare = `${String(next)}${context.orderedDelimiter} `;
@@ -175,7 +186,7 @@ function renderListRegion(items, context) {
175
186
  if (partIndex > 0) {
176
187
  const previous = parts[partIndex - 1];
177
188
  const sameList = previous.numId === part.numId;
178
- 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);
179
190
  out += sameList && !loose ? "\n" : "\n\n";
180
191
  }
181
192
  out += part.text;
@@ -217,7 +228,8 @@ function emitMarkdown(document, options = {}) {
217
228
  headingStyle: options.headingStyle ?? "atx",
218
229
  embedImages: options.images ?? true,
219
230
  orderedCounters: /* @__PURE__ */ new Map(),
220
- reportedFallbackNumIds: /* @__PURE__ */ new Set()
231
+ reportedFallbackNumIds: /* @__PURE__ */ new Set(),
232
+ reportedAbsentNumIdFallback: false
221
233
  };
222
234
  const body = document.sections.map((section) => emitBlocks(section.blocks, context)).join("\n\n");
223
235
  const frontMatter = options.frontMatter === true ? require_emit_front_matter.emitFrontMatter(document.metadata) : void 0;
package/dist/emit/emit.js CHANGED
@@ -93,6 +93,17 @@ function renderTopLevelBlock(block, context) {
93
93
  }
94
94
  }
95
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
+ }
96
107
  const info = parseListNumId(numId);
97
108
  if (info === void 0 && !context.reportedFallbackNumIds.has(numId)) {
98
109
  context.reportedFallbackNumIds.add(numId);
@@ -127,7 +138,7 @@ function stripCheckboxRun(item, checkboxPrefix) {
127
138
  }
128
139
  function renderListItemMarker(numId, info, item, context) {
129
140
  const checkboxText = (info?.task === true ? checkboxPrefixFor(item) : void 0) ?? "";
130
- if (info?.type === "ordered") {
141
+ if (info?.type === "ordered" && numId !== void 0) {
131
142
  const next = context.orderedCounters.get(numId) ?? info.start ?? 1;
132
143
  context.orderedCounters.set(numId, next + 1);
133
144
  const bare = `${String(next)}${context.orderedDelimiter} `;
@@ -174,7 +185,7 @@ function renderListRegion(items, context) {
174
185
  if (partIndex > 0) {
175
186
  const previous = parts[partIndex - 1];
176
187
  const sameList = previous.numId === part.numId;
177
- const loose = sameList && (parseListNumId(previous.numId)?.loose ?? false);
188
+ const loose = sameList && previous.numId !== void 0 && (parseListNumId(previous.numId)?.loose ?? false);
178
189
  out += sameList && !loose ? "\n" : "\n\n";
179
190
  }
180
191
  out += part.text;
@@ -216,7 +227,8 @@ function emitMarkdown(document, options = {}) {
216
227
  headingStyle: options.headingStyle ?? "atx",
217
228
  embedImages: options.images ?? true,
218
229
  orderedCounters: /* @__PURE__ */ new Map(),
219
- reportedFallbackNumIds: /* @__PURE__ */ new Set()
230
+ reportedFallbackNumIds: /* @__PURE__ */ new Set(),
231
+ reportedAbsentNumIdFallback: false
220
232
  };
221
233
  const body = document.sections.map((section) => emitBlocks(section.blocks, context)).join("\n\n");
222
234
  const frontMatter = options.frontMatter === true ? emitFrontMatter(document.metadata) : void 0;
@@ -271,15 +271,13 @@ function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
271
271
  quoteDepth: 0,
272
272
  list: void 0
273
273
  };
274
- const blocks = parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt));
275
274
  return {
276
275
  kind: "wordprocessing",
277
- formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
278
276
  metadata,
279
277
  sections: [{
280
278
  pageSize,
281
279
  margins,
282
- blocks
280
+ blocks: parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt))
283
281
  }]
284
282
  };
285
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 {
@@ -270,15 +270,13 @@ function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
270
270
  quoteDepth: 0,
271
271
  list: void 0
272
272
  };
273
- const blocks = parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt));
274
273
  return {
275
274
  kind: "wordprocessing",
276
- formatVersion: CONTENT_FORMAT_VERSION,
277
275
  metadata,
278
276
  sections: [{
279
277
  pageSize,
280
278
  margins,
281
- blocks
279
+ blocks: parsed.document.children.flatMap((child) => lowerBlock(child, context, contentWidthPt))
282
280
  }]
283
281
  };
284
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-codec",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
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": "^3.1.0",
82
+ "document-schema.js": "^4.1.0",
83
83
  "zod": "^4.4.3"
84
84
  },
85
85
  "devDependencies": {