markdown-codec 11.1.7 → 11.1.9

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.
@@ -138,6 +138,7 @@ var BlockParser = class {
138
138
  case "heading":
139
139
  case "thematicBreak": return "not-matched";
140
140
  }
141
+ return assertNeverBlockKind(node.kind);
141
142
  }
142
143
  continueBlockquote() {
143
144
  if (!this.consumeBlockquoteMarker()) return "not-matched";
@@ -437,6 +438,7 @@ var BlockParser = class {
437
438
  case "list":
438
439
  require_block_list.finalizeListTightness(node);
439
440
  return;
441
+ default: return;
440
442
  }
441
443
  }
442
444
  finalizeCodeBlock(node) {
@@ -577,6 +579,7 @@ function toAstBlock(node, context) {
577
579
  case "document":
578
580
  case "listItem": return;
579
581
  }
582
+ return assertNeverBlockKind(node.kind);
580
583
  }
581
584
  function toAstBlocks(nodes, context) {
582
585
  const blocks = [];
@@ -603,9 +606,13 @@ function parseMarkdown(source, options = {}) {
603
606
  footnotes: context.footnotes
604
607
  };
605
608
  }
609
+ function assertNeverBlockKind(kind) {
610
+ throw new Error(`markdown-codec: unhandled block kind ${JSON.stringify(kind)}`);
611
+ }
606
612
  //#endregion
607
613
  exports.ATX_MARKER_PATTERN = ATX_MARKER_PATTERN;
608
614
  exports.CODE_FENCE_PATTERN = CODE_FENCE_PATTERN;
609
615
  exports.MATH_BLOCK_MARKER_PATTERN = MATH_BLOCK_MARKER_PATTERN;
610
616
  exports.THEMATIC_BREAK_PATTERN = THEMATIC_BREAK_PATTERN;
617
+ exports.assertNeverBlockKind = assertNeverBlockKind;
611
618
  exports.parseMarkdown = parseMarkdown;
@@ -2,7 +2,7 @@ import { s as MarkdownDocumentNode } from "../ast-CNfTgS0N.cjs";
2
2
  import { r as FootnoteLabelSet } from "../footnote-CKk4JbLk.cjs";
3
3
  import { i as MarkdownDiagnosticSink } from "../diagnostics-D3UiC9HL.cjs";
4
4
  import { LinkReferenceMap } from "../inline/link.cjs";
5
- import { t as InlineParseOptions } from "../inline-CnO86zMw.cjs";
5
+ import { t as InlineParseOptions } from "../inline-B8WNyxnI.cjs";
6
6
  //#region src/block/block.d.ts
7
7
  declare const ATX_MARKER_PATTERN: RegExp;
8
8
  declare const CODE_FENCE_PATTERN: RegExp;
@@ -21,5 +21,6 @@ interface ParsedMarkdown {
21
21
  readonly footnotes: FootnoteLabelSet;
22
22
  }
23
23
  declare function parseMarkdown(source: string, options?: MarkdownParseOptions): ParsedMarkdown;
24
+ declare function assertNeverBlockKind(kind: never): never;
24
25
  //#endregion
25
- export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, parseMarkdown };
26
+ export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, assertNeverBlockKind, parseMarkdown };
@@ -2,7 +2,7 @@ import { s as MarkdownDocumentNode } from "../ast-CNfTgS0N.js";
2
2
  import { r as FootnoteLabelSet } from "../footnote-CKk4JbLk.js";
3
3
  import { i as MarkdownDiagnosticSink } from "../diagnostics-D3UiC9HL.js";
4
4
  import { LinkReferenceMap } from "../inline/link.js";
5
- import { t as InlineParseOptions } from "../inline-DItZ-VVw.js";
5
+ import { t as InlineParseOptions } from "../inline-BBtsaDjb.js";
6
6
  //#region src/block/block.d.ts
7
7
  declare const ATX_MARKER_PATTERN: RegExp;
8
8
  declare const CODE_FENCE_PATTERN: RegExp;
@@ -21,5 +21,6 @@ interface ParsedMarkdown {
21
21
  readonly footnotes: FootnoteLabelSet;
22
22
  }
23
23
  declare function parseMarkdown(source: string, options?: MarkdownParseOptions): ParsedMarkdown;
24
+ declare function assertNeverBlockKind(kind: never): never;
24
25
  //#endregion
25
- export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, parseMarkdown };
26
+ export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, assertNeverBlockKind, parseMarkdown };
@@ -137,6 +137,7 @@ var BlockParser = class {
137
137
  case "heading":
138
138
  case "thematicBreak": return "not-matched";
139
139
  }
140
+ return assertNeverBlockKind(node.kind);
140
141
  }
141
142
  continueBlockquote() {
142
143
  if (!this.consumeBlockquoteMarker()) return "not-matched";
@@ -436,6 +437,7 @@ var BlockParser = class {
436
437
  case "list":
437
438
  finalizeListTightness(node);
438
439
  return;
440
+ default: return;
439
441
  }
440
442
  }
441
443
  finalizeCodeBlock(node) {
@@ -576,6 +578,7 @@ function toAstBlock(node, context) {
576
578
  case "document":
577
579
  case "listItem": return;
578
580
  }
581
+ return assertNeverBlockKind(node.kind);
579
582
  }
580
583
  function toAstBlocks(nodes, context) {
581
584
  const blocks = [];
@@ -602,5 +605,8 @@ function parseMarkdown(source, options = {}) {
602
605
  footnotes: context.footnotes
603
606
  };
604
607
  }
608
+ function assertNeverBlockKind(kind) {
609
+ throw new Error(`markdown-codec: unhandled block kind ${JSON.stringify(kind)}`);
610
+ }
605
611
  //#endregion
606
- export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, THEMATIC_BREAK_PATTERN, parseMarkdown };
612
+ export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, THEMATIC_BREAK_PATTERN, assertNeverBlockKind, parseMarkdown };
package/dist/codec.d.cts CHANGED
@@ -17,8 +17,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
17
17
  paragraph: z.ZodOptional<z.ZodObject<{
18
18
  alignment: z.ZodOptional<z.ZodEnum<{
19
19
  left: "left";
20
- center: "center";
21
20
  right: "right";
21
+ center: "center";
22
22
  justify: "justify";
23
23
  }>>;
24
24
  list: z.ZodOptional<z.ZodObject<{
@@ -103,9 +103,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
103
103
  symbol: z.ZodString;
104
104
  name: z.ZodOptional<z.ZodString>;
105
105
  dimension: z.ZodRecord<z.ZodEnum<{
106
- time: "time";
107
106
  length: "length";
108
107
  mass: "mass";
108
+ time: "time";
109
109
  electricCurrent: "electricCurrent";
110
110
  thermodynamicTemperature: "thermodynamicTemperature";
111
111
  amountOfSubstance: "amountOfSubstance";
@@ -172,8 +172,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
172
172
  paragraph: z.ZodOptional<z.ZodObject<{
173
173
  alignment: z.ZodOptional<z.ZodEnum<{
174
174
  left: "left";
175
- center: "center";
176
175
  right: "right";
176
+ center: "center";
177
177
  justify: "justify";
178
178
  }>>;
179
179
  list: z.ZodOptional<z.ZodObject<{
@@ -258,9 +258,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
258
258
  symbol: z.ZodString;
259
259
  name: z.ZodOptional<z.ZodString>;
260
260
  dimension: z.ZodRecord<z.ZodEnum<{
261
- time: "time";
262
261
  length: "length";
263
262
  mass: "mass";
263
+ time: "time";
264
264
  electricCurrent: "electricCurrent";
265
265
  thermodynamicTemperature: "thermodynamicTemperature";
266
266
  amountOfSubstance: "amountOfSubstance";
@@ -332,8 +332,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
332
332
  paragraph: z.ZodOptional<z.ZodObject<{
333
333
  alignment: z.ZodOptional<z.ZodEnum<{
334
334
  left: "left";
335
- center: "center";
336
335
  right: "right";
336
+ center: "center";
337
337
  justify: "justify";
338
338
  }>>;
339
339
  list: z.ZodOptional<z.ZodObject<{
@@ -418,9 +418,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
418
418
  symbol: z.ZodString;
419
419
  name: z.ZodOptional<z.ZodString>;
420
420
  dimension: z.ZodRecord<z.ZodEnum<{
421
- time: "time";
422
421
  length: "length";
423
422
  mass: "mass";
423
+ time: "time";
424
424
  electricCurrent: "electricCurrent";
425
425
  thermodynamicTemperature: "thermodynamicTemperature";
426
426
  amountOfSubstance: "amountOfSubstance";
@@ -487,8 +487,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
487
487
  paragraph: z.ZodOptional<z.ZodObject<{
488
488
  alignment: z.ZodOptional<z.ZodEnum<{
489
489
  left: "left";
490
- center: "center";
491
490
  right: "right";
491
+ center: "center";
492
492
  justify: "justify";
493
493
  }>>;
494
494
  list: z.ZodOptional<z.ZodObject<{
@@ -573,9 +573,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
573
573
  symbol: z.ZodString;
574
574
  name: z.ZodOptional<z.ZodString>;
575
575
  dimension: z.ZodRecord<z.ZodEnum<{
576
- time: "time";
577
576
  length: "length";
578
577
  mass: "mass";
578
+ time: "time";
579
579
  electricCurrent: "electricCurrent";
580
580
  thermodynamicTemperature: "thermodynamicTemperature";
581
581
  amountOfSubstance: "amountOfSubstance";
@@ -701,8 +701,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
701
701
  paragraph: z.ZodOptional<z.ZodObject<{
702
702
  alignment: z.ZodOptional<z.ZodEnum<{
703
703
  left: "left";
704
- center: "center";
705
704
  right: "right";
705
+ center: "center";
706
706
  justify: "justify";
707
707
  }>>;
708
708
  list: z.ZodOptional<z.ZodObject<{
@@ -787,9 +787,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
787
787
  symbol: z.ZodString;
788
788
  name: z.ZodOptional<z.ZodString>;
789
789
  dimension: z.ZodRecord<z.ZodEnum<{
790
- time: "time";
791
790
  length: "length";
792
791
  mass: "mass";
792
+ time: "time";
793
793
  electricCurrent: "electricCurrent";
794
794
  thermodynamicTemperature: "thermodynamicTemperature";
795
795
  amountOfSubstance: "amountOfSubstance";
@@ -937,9 +937,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
937
937
  symbol: z.ZodString;
938
938
  name: z.ZodOptional<z.ZodString>;
939
939
  dimension: z.ZodRecord<z.ZodEnum<{
940
- time: "time";
941
940
  length: "length";
942
941
  mass: "mass";
942
+ time: "time";
943
943
  electricCurrent: "electricCurrent";
944
944
  thermodynamicTemperature: "thermodynamicTemperature";
945
945
  amountOfSubstance: "amountOfSubstance";
@@ -1133,9 +1133,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1133
1133
  symbol: z.ZodString;
1134
1134
  name: z.ZodOptional<z.ZodString>;
1135
1135
  dimension: z.ZodRecord<z.ZodEnum<{
1136
- time: "time";
1137
1136
  length: "length";
1138
1137
  mass: "mass";
1138
+ time: "time";
1139
1139
  electricCurrent: "electricCurrent";
1140
1140
  thermodynamicTemperature: "thermodynamicTemperature";
1141
1141
  amountOfSubstance: "amountOfSubstance";
@@ -1538,8 +1538,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1538
1538
  }, z.core.$strip>>;
1539
1539
  alignment: z.ZodOptional<z.ZodEnum<{
1540
1540
  left: "left";
1541
- center: "center";
1542
1541
  right: "right";
1542
+ center: "center";
1543
1543
  justify: "justify";
1544
1544
  }>>;
1545
1545
  verticalAlignment: z.ZodOptional<z.ZodEnum<{
@@ -1681,10 +1681,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1681
1681
  }>;
1682
1682
  align: z.ZodEnum<{
1683
1683
  left: "left";
1684
- center: "center";
1685
1684
  right: "right";
1686
1685
  top: "top";
1687
1686
  bottom: "bottom";
1687
+ center: "center";
1688
1688
  inside: "inside";
1689
1689
  outside: "outside";
1690
1690
  }>;
@@ -1724,10 +1724,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1724
1724
  }>;
1725
1725
  align: z.ZodEnum<{
1726
1726
  left: "left";
1727
- center: "center";
1728
1727
  right: "right";
1729
1728
  top: "top";
1730
1729
  bottom: "bottom";
1730
+ center: "center";
1731
1731
  inside: "inside";
1732
1732
  outside: "outside";
1733
1733
  }>;
@@ -2478,9 +2478,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
2478
2478
  symbol: z.ZodString;
2479
2479
  name: z.ZodOptional<z.ZodString>;
2480
2480
  dimension: z.ZodRecord<z.ZodEnum<{
2481
- time: "time";
2482
2481
  length: "length";
2483
2482
  mass: "mass";
2483
+ time: "time";
2484
2484
  electricCurrent: "electricCurrent";
2485
2485
  thermodynamicTemperature: "thermodynamicTemperature";
2486
2486
  amountOfSubstance: "amountOfSubstance";
@@ -3208,9 +3208,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
3208
3208
  symbol: z.ZodString;
3209
3209
  name: z.ZodOptional<z.ZodString>;
3210
3210
  dimension: z.ZodRecord<z.ZodEnum<{
3211
- time: "time";
3212
3211
  length: "length";
3213
3212
  mass: "mass";
3213
+ time: "time";
3214
3214
  electricCurrent: "electricCurrent";
3215
3215
  thermodynamicTemperature: "thermodynamicTemperature";
3216
3216
  amountOfSubstance: "amountOfSubstance";
@@ -3336,9 +3336,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
3336
3336
  symbol: z.ZodString;
3337
3337
  name: z.ZodOptional<z.ZodString>;
3338
3338
  dimension: z.ZodRecord<z.ZodEnum<{
3339
- time: "time";
3340
3339
  length: "length";
3341
3340
  mass: "mass";
3341
+ time: "time";
3342
3342
  electricCurrent: "electricCurrent";
3343
3343
  thermodynamicTemperature: "thermodynamicTemperature";
3344
3344
  amountOfSubstance: "amountOfSubstance";
package/dist/codec.d.ts CHANGED
@@ -17,8 +17,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
17
17
  paragraph: z.ZodOptional<z.ZodObject<{
18
18
  alignment: z.ZodOptional<z.ZodEnum<{
19
19
  left: "left";
20
- center: "center";
21
20
  right: "right";
21
+ center: "center";
22
22
  justify: "justify";
23
23
  }>>;
24
24
  list: z.ZodOptional<z.ZodObject<{
@@ -103,9 +103,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
103
103
  symbol: z.ZodString;
104
104
  name: z.ZodOptional<z.ZodString>;
105
105
  dimension: z.ZodRecord<z.ZodEnum<{
106
- time: "time";
107
106
  length: "length";
108
107
  mass: "mass";
108
+ time: "time";
109
109
  electricCurrent: "electricCurrent";
110
110
  thermodynamicTemperature: "thermodynamicTemperature";
111
111
  amountOfSubstance: "amountOfSubstance";
@@ -172,8 +172,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
172
172
  paragraph: z.ZodOptional<z.ZodObject<{
173
173
  alignment: z.ZodOptional<z.ZodEnum<{
174
174
  left: "left";
175
- center: "center";
176
175
  right: "right";
176
+ center: "center";
177
177
  justify: "justify";
178
178
  }>>;
179
179
  list: z.ZodOptional<z.ZodObject<{
@@ -258,9 +258,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
258
258
  symbol: z.ZodString;
259
259
  name: z.ZodOptional<z.ZodString>;
260
260
  dimension: z.ZodRecord<z.ZodEnum<{
261
- time: "time";
262
261
  length: "length";
263
262
  mass: "mass";
263
+ time: "time";
264
264
  electricCurrent: "electricCurrent";
265
265
  thermodynamicTemperature: "thermodynamicTemperature";
266
266
  amountOfSubstance: "amountOfSubstance";
@@ -332,8 +332,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
332
332
  paragraph: z.ZodOptional<z.ZodObject<{
333
333
  alignment: z.ZodOptional<z.ZodEnum<{
334
334
  left: "left";
335
- center: "center";
336
335
  right: "right";
336
+ center: "center";
337
337
  justify: "justify";
338
338
  }>>;
339
339
  list: z.ZodOptional<z.ZodObject<{
@@ -418,9 +418,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
418
418
  symbol: z.ZodString;
419
419
  name: z.ZodOptional<z.ZodString>;
420
420
  dimension: z.ZodRecord<z.ZodEnum<{
421
- time: "time";
422
421
  length: "length";
423
422
  mass: "mass";
423
+ time: "time";
424
424
  electricCurrent: "electricCurrent";
425
425
  thermodynamicTemperature: "thermodynamicTemperature";
426
426
  amountOfSubstance: "amountOfSubstance";
@@ -487,8 +487,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
487
487
  paragraph: z.ZodOptional<z.ZodObject<{
488
488
  alignment: z.ZodOptional<z.ZodEnum<{
489
489
  left: "left";
490
- center: "center";
491
490
  right: "right";
491
+ center: "center";
492
492
  justify: "justify";
493
493
  }>>;
494
494
  list: z.ZodOptional<z.ZodObject<{
@@ -573,9 +573,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
573
573
  symbol: z.ZodString;
574
574
  name: z.ZodOptional<z.ZodString>;
575
575
  dimension: z.ZodRecord<z.ZodEnum<{
576
- time: "time";
577
576
  length: "length";
578
577
  mass: "mass";
578
+ time: "time";
579
579
  electricCurrent: "electricCurrent";
580
580
  thermodynamicTemperature: "thermodynamicTemperature";
581
581
  amountOfSubstance: "amountOfSubstance";
@@ -701,8 +701,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
701
701
  paragraph: z.ZodOptional<z.ZodObject<{
702
702
  alignment: z.ZodOptional<z.ZodEnum<{
703
703
  left: "left";
704
- center: "center";
705
704
  right: "right";
705
+ center: "center";
706
706
  justify: "justify";
707
707
  }>>;
708
708
  list: z.ZodOptional<z.ZodObject<{
@@ -787,9 +787,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
787
787
  symbol: z.ZodString;
788
788
  name: z.ZodOptional<z.ZodString>;
789
789
  dimension: z.ZodRecord<z.ZodEnum<{
790
- time: "time";
791
790
  length: "length";
792
791
  mass: "mass";
792
+ time: "time";
793
793
  electricCurrent: "electricCurrent";
794
794
  thermodynamicTemperature: "thermodynamicTemperature";
795
795
  amountOfSubstance: "amountOfSubstance";
@@ -937,9 +937,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
937
937
  symbol: z.ZodString;
938
938
  name: z.ZodOptional<z.ZodString>;
939
939
  dimension: z.ZodRecord<z.ZodEnum<{
940
- time: "time";
941
940
  length: "length";
942
941
  mass: "mass";
942
+ time: "time";
943
943
  electricCurrent: "electricCurrent";
944
944
  thermodynamicTemperature: "thermodynamicTemperature";
945
945
  amountOfSubstance: "amountOfSubstance";
@@ -1133,9 +1133,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1133
1133
  symbol: z.ZodString;
1134
1134
  name: z.ZodOptional<z.ZodString>;
1135
1135
  dimension: z.ZodRecord<z.ZodEnum<{
1136
- time: "time";
1137
1136
  length: "length";
1138
1137
  mass: "mass";
1138
+ time: "time";
1139
1139
  electricCurrent: "electricCurrent";
1140
1140
  thermodynamicTemperature: "thermodynamicTemperature";
1141
1141
  amountOfSubstance: "amountOfSubstance";
@@ -1538,8 +1538,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1538
1538
  }, z.core.$strip>>;
1539
1539
  alignment: z.ZodOptional<z.ZodEnum<{
1540
1540
  left: "left";
1541
- center: "center";
1542
1541
  right: "right";
1542
+ center: "center";
1543
1543
  justify: "justify";
1544
1544
  }>>;
1545
1545
  verticalAlignment: z.ZodOptional<z.ZodEnum<{
@@ -1681,10 +1681,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1681
1681
  }>;
1682
1682
  align: z.ZodEnum<{
1683
1683
  left: "left";
1684
- center: "center";
1685
1684
  right: "right";
1686
1685
  top: "top";
1687
1686
  bottom: "bottom";
1687
+ center: "center";
1688
1688
  inside: "inside";
1689
1689
  outside: "outside";
1690
1690
  }>;
@@ -1724,10 +1724,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1724
1724
  }>;
1725
1725
  align: z.ZodEnum<{
1726
1726
  left: "left";
1727
- center: "center";
1728
1727
  right: "right";
1729
1728
  top: "top";
1730
1729
  bottom: "bottom";
1730
+ center: "center";
1731
1731
  inside: "inside";
1732
1732
  outside: "outside";
1733
1733
  }>;
@@ -2478,9 +2478,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
2478
2478
  symbol: z.ZodString;
2479
2479
  name: z.ZodOptional<z.ZodString>;
2480
2480
  dimension: z.ZodRecord<z.ZodEnum<{
2481
- time: "time";
2482
2481
  length: "length";
2483
2482
  mass: "mass";
2483
+ time: "time";
2484
2484
  electricCurrent: "electricCurrent";
2485
2485
  thermodynamicTemperature: "thermodynamicTemperature";
2486
2486
  amountOfSubstance: "amountOfSubstance";
@@ -3208,9 +3208,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
3208
3208
  symbol: z.ZodString;
3209
3209
  name: z.ZodOptional<z.ZodString>;
3210
3210
  dimension: z.ZodRecord<z.ZodEnum<{
3211
- time: "time";
3212
3211
  length: "length";
3213
3212
  mass: "mass";
3213
+ time: "time";
3214
3214
  electricCurrent: "electricCurrent";
3215
3215
  thermodynamicTemperature: "thermodynamicTemperature";
3216
3216
  amountOfSubstance: "amountOfSubstance";
@@ -3336,9 +3336,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
3336
3336
  symbol: z.ZodString;
3337
3337
  name: z.ZodOptional<z.ZodString>;
3338
3338
  dimension: z.ZodRecord<z.ZodEnum<{
3339
- time: "time";
3340
3339
  length: "length";
3341
3340
  mass: "mass";
3341
+ time: "time";
3342
3342
  electricCurrent: "electricCurrent";
3343
3343
  thermodynamicTemperature: "thermodynamicTemperature";
3344
3344
  amountOfSubstance: "amountOfSubstance";
@@ -219,6 +219,7 @@ function renderTopLevelBlock(block, context) {
219
219
  return "";
220
220
  case "pageBreak": return "";
221
221
  }
222
+ return assertNeverRenderableBlock(block);
222
223
  }
223
224
  function listInfoFor(numId, context) {
224
225
  if (numId === void 0) {
@@ -245,8 +246,8 @@ function listInfoFor(numId, context) {
245
246
  }
246
247
  function stripCheckboxRun(item) {
247
248
  const first = item.runs[0];
248
- const glyphPrefix = first?.text.startsWith(`☒ `) ? `☒ ` : `☐ `;
249
- if (!first?.text.startsWith(glyphPrefix)) return item;
249
+ const glyphPrefix = first?.text.startsWith(`☒ `) === true ? `☒ ` : `☐ `;
250
+ if (first?.text.startsWith(glyphPrefix) !== true) return item;
250
251
  const strippedText = first.text.slice(glyphPrefix.length);
251
252
  const runs = strippedText.length === 0 ? item.runs.slice(1) : [{
252
253
  ...first,
@@ -638,5 +639,9 @@ function emitMarkdown(document, options = {}) {
638
639
  const text = frontMatter === void 0 ? body : `${frontMatter}\n\n${body}`;
639
640
  return (options.lineEnding ?? "lf") === "crlf" ? text.replaceAll("\n", "\r\n") : text;
640
641
  }
642
+ function assertNeverRenderableBlock(block) {
643
+ throw new Error(`markdown-codec: unhandled renderable block ${JSON.stringify(block)}`);
644
+ }
641
645
  //#endregion
646
+ exports.assertNeverRenderableBlock = assertNeverRenderableBlock;
642
647
  exports.emitMarkdown = emitMarkdown;
@@ -2,5 +2,6 @@ import { WriteMarkdownOptions } from "../options/options.cjs";
2
2
  import { ContentDocument } from "document-schema.js";
3
3
  //#region src/emit/emit.d.ts
4
4
  declare function emitMarkdown(document: ContentDocument, options?: WriteMarkdownOptions): string;
5
+ declare function assertNeverRenderableBlock(block: never): never;
5
6
  //#endregion
6
- export { emitMarkdown };
7
+ export { assertNeverRenderableBlock, emitMarkdown };
@@ -2,5 +2,6 @@ import { WriteMarkdownOptions } from "../options/options.js";
2
2
  import { ContentDocument } from "document-schema.js";
3
3
  //#region src/emit/emit.d.ts
4
4
  declare function emitMarkdown(document: ContentDocument, options?: WriteMarkdownOptions): string;
5
+ declare function assertNeverRenderableBlock(block: never): never;
5
6
  //#endregion
6
- export { emitMarkdown };
7
+ export { assertNeverRenderableBlock, emitMarkdown };
package/dist/emit/emit.js CHANGED
@@ -218,6 +218,7 @@ function renderTopLevelBlock(block, context) {
218
218
  return "";
219
219
  case "pageBreak": return "";
220
220
  }
221
+ return assertNeverRenderableBlock(block);
221
222
  }
222
223
  function listInfoFor(numId, context) {
223
224
  if (numId === void 0) {
@@ -244,8 +245,8 @@ function listInfoFor(numId, context) {
244
245
  }
245
246
  function stripCheckboxRun(item) {
246
247
  const first = item.runs[0];
247
- const glyphPrefix = first?.text.startsWith(`☒ `) ? `☒ ` : `☐ `;
248
- if (!first?.text.startsWith(glyphPrefix)) return item;
248
+ const glyphPrefix = first?.text.startsWith(`☒ `) === true ? `☒ ` : `☐ `;
249
+ if (first?.text.startsWith(glyphPrefix) !== true) return item;
249
250
  const strippedText = first.text.slice(glyphPrefix.length);
250
251
  const runs = strippedText.length === 0 ? item.runs.slice(1) : [{
251
252
  ...first,
@@ -637,5 +638,8 @@ function emitMarkdown(document, options = {}) {
637
638
  const text = frontMatter === void 0 ? body : `${frontMatter}\n\n${body}`;
638
639
  return (options.lineEnding ?? "lf") === "crlf" ? text.replaceAll("\n", "\r\n") : text;
639
640
  }
641
+ function assertNeverRenderableBlock(block) {
642
+ throw new Error(`markdown-codec: unhandled renderable block ${JSON.stringify(block)}`);
643
+ }
640
644
  //#endregion
641
- export { emitMarkdown };
645
+ export { assertNeverRenderableBlock, emitMarkdown };
@@ -14,6 +14,7 @@ function delimiterCell(alignment) {
14
14
  case "center": return ":---:";
15
15
  case "none": return "---";
16
16
  }
17
+ return assertNeverAlignment(alignment);
17
18
  }
18
19
  function escapeUnescapedPipes(text) {
19
20
  let out = "";
@@ -91,5 +92,9 @@ function emitTable(table, context) {
91
92
  ...body.map((row) => `| ${row.cells.map((cell) => renderCellText(cell, context)).join(" | ")} |`)
92
93
  ].join("\n");
93
94
  }
95
+ function assertNeverAlignment(alignment) {
96
+ throw new Error(`markdown-codec: unhandled table alignment ${JSON.stringify(alignment)}`);
97
+ }
94
98
  //#endregion
99
+ exports.assertNeverAlignment = assertNeverAlignment;
95
100
  exports.emitTable = emitTable;
@@ -7,5 +7,6 @@ interface TableEmitContext extends InlineEmitContext {
7
7
  readonly embedImages: boolean;
8
8
  }
9
9
  declare function emitTable(table: ContentTable, context: TableEmitContext): string;
10
+ declare function assertNeverAlignment(alignment: never): never;
10
11
  //#endregion
11
- export { TableEmitContext, emitTable };
12
+ export { TableEmitContext, assertNeverAlignment, emitTable };
@@ -7,5 +7,6 @@ interface TableEmitContext extends InlineEmitContext {
7
7
  readonly embedImages: boolean;
8
8
  }
9
9
  declare function emitTable(table: ContentTable, context: TableEmitContext): string;
10
+ declare function assertNeverAlignment(alignment: never): never;
10
11
  //#endregion
11
- export { TableEmitContext, emitTable };
12
+ export { TableEmitContext, assertNeverAlignment, emitTable };
@@ -13,6 +13,7 @@ function delimiterCell(alignment) {
13
13
  case "center": return ":---:";
14
14
  case "none": return "---";
15
15
  }
16
+ return assertNeverAlignment(alignment);
16
17
  }
17
18
  function escapeUnescapedPipes(text) {
18
19
  let out = "";
@@ -90,5 +91,8 @@ function emitTable(table, context) {
90
91
  ...body.map((row) => `| ${row.cells.map((cell) => renderCellText(cell, context)).join(" | ")} |`)
91
92
  ].join("\n");
92
93
  }
94
+ function assertNeverAlignment(alignment) {
95
+ throw new Error(`markdown-codec: unhandled table alignment ${JSON.stringify(alignment)}`);
96
+ }
93
97
  //#endregion
94
- export { emitTable };
98
+ export { assertNeverAlignment, emitTable };
@@ -82,6 +82,7 @@ function renderInline(node) {
82
82
  case "footnoteReference": return escapeHtml(`[^${node.label}]`);
83
83
  case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
84
84
  }
85
+ return assertNeverInlineNode(node);
85
86
  }
86
87
  function renderInlines(nodes) {
87
88
  return nodes.map(renderInline).join("");
@@ -191,7 +192,11 @@ function renderDocumentToHtml(document) {
191
192
  renderer.render(document.children, false);
192
193
  return renderer.result();
193
194
  }
195
+ function assertNeverInlineNode(node) {
196
+ throw new Error(`markdown-codec: unhandled inline node ${JSON.stringify(node)}`);
197
+ }
194
198
  //#endregion
199
+ exports.assertNeverInlineNode = assertNeverInlineNode;
195
200
  exports.escapeHref = escapeHref;
196
201
  exports.escapeHtml = escapeHtml;
197
202
  exports.renderDocumentToHtml = renderDocumentToHtml;
@@ -4,5 +4,6 @@ declare function escapeHtml(text: string): string;
4
4
  declare function escapeHref(href: string): string;
5
5
  declare function renderInlines(nodes: readonly MarkdownInlineNode[]): string;
6
6
  declare function renderDocumentToHtml(document: MarkdownDocumentNode): string;
7
+ declare function assertNeverInlineNode(node: never): never;
7
8
  //#endregion
8
- export { escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
9
+ export { assertNeverInlineNode, escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
@@ -4,5 +4,6 @@ declare function escapeHtml(text: string): string;
4
4
  declare function escapeHref(href: string): string;
5
5
  declare function renderInlines(nodes: readonly MarkdownInlineNode[]): string;
6
6
  declare function renderDocumentToHtml(document: MarkdownDocumentNode): string;
7
+ declare function assertNeverInlineNode(node: never): never;
7
8
  //#endregion
8
- export { escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
9
+ export { assertNeverInlineNode, escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
@@ -81,6 +81,7 @@ function renderInline(node) {
81
81
  case "footnoteReference": return escapeHtml(`[^${node.label}]`);
82
82
  case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
83
83
  }
84
+ return assertNeverInlineNode(node);
84
85
  }
85
86
  function renderInlines(nodes) {
86
87
  return nodes.map(renderInline).join("");
@@ -190,5 +191,8 @@ function renderDocumentToHtml(document) {
190
191
  renderer.render(document.children, false);
191
192
  return renderer.result();
192
193
  }
194
+ function assertNeverInlineNode(node) {
195
+ throw new Error(`markdown-codec: unhandled inline node ${JSON.stringify(node)}`);
196
+ }
193
197
  //#endregion
194
- export { escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
198
+ export { assertNeverInlineNode, escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
@@ -478,11 +478,16 @@ function toAstNode(node) {
478
478
  };
479
479
  case "container": return;
480
480
  }
481
+ return assertNeverInlineKind(node.kind);
481
482
  }
482
483
  function parseInlines(content, references, footnotes, options = {}) {
483
484
  const root = new InlineParser(content, references, footnotes, options).parse();
484
485
  if (options.gfmAutolinks ?? true) require_inline_gfm_autolink.applyGfmAutolinks(root);
485
486
  return toChildAstNodes(root);
486
487
  }
488
+ function assertNeverInlineKind(kind) {
489
+ throw new Error(`markdown-codec: unhandled inline kind ${JSON.stringify(kind)}`);
490
+ }
487
491
  //#endregion
492
+ exports.assertNeverInlineKind = assertNeverInlineKind;
488
493
  exports.parseInlines = parseInlines;
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-CnO86zMw.cjs";
2
- export { InlineParseOptions, parseInlines };
1
+ import { n as assertNeverInlineKind, r as parseInlines, t as InlineParseOptions } from "../inline-B8WNyxnI.cjs";
2
+ export { InlineParseOptions, assertNeverInlineKind, parseInlines };
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-DItZ-VVw.js";
2
- export { InlineParseOptions, parseInlines };
1
+ import { n as assertNeverInlineKind, r as parseInlines, t as InlineParseOptions } from "../inline-BBtsaDjb.js";
2
+ export { InlineParseOptions, assertNeverInlineKind, parseInlines };
@@ -477,11 +477,15 @@ function toAstNode(node) {
477
477
  };
478
478
  case "container": return;
479
479
  }
480
+ return assertNeverInlineKind(node.kind);
480
481
  }
481
482
  function parseInlines(content, references, footnotes, options = {}) {
482
483
  const root = new InlineParser(content, references, footnotes, options).parse();
483
484
  if (options.gfmAutolinks ?? true) applyGfmAutolinks(root);
484
485
  return toChildAstNodes(root);
485
486
  }
487
+ function assertNeverInlineKind(kind) {
488
+ throw new Error(`markdown-codec: unhandled inline kind ${JSON.stringify(kind)}`);
489
+ }
486
490
  //#endregion
487
- export { parseInlines };
491
+ export { assertNeverInlineKind, parseInlines };
@@ -7,5 +7,6 @@ interface InlineParseOptions {
7
7
  readonly gfmStrikethrough?: boolean;
8
8
  }
9
9
  declare function parseInlines(content: string, references: LinkReferenceMap, footnotes: FootnoteLabelSet, options?: InlineParseOptions): MarkdownInlineNode[];
10
+ declare function assertNeverInlineKind(kind: never): never;
10
11
  //#endregion
11
- export { parseInlines as n, InlineParseOptions as t };
12
+ export { assertNeverInlineKind as n, parseInlines as r, InlineParseOptions as t };
@@ -7,5 +7,6 @@ interface InlineParseOptions {
7
7
  readonly gfmStrikethrough?: boolean;
8
8
  }
9
9
  declare function parseInlines(content: string, references: LinkReferenceMap, footnotes: FootnoteLabelSet, options?: InlineParseOptions): MarkdownInlineNode[];
10
+ declare function assertNeverInlineKind(kind: never): never;
10
11
  //#endregion
11
- export { parseInlines as n, InlineParseOptions as t };
12
+ export { assertNeverInlineKind as n, parseInlines as r, InlineParseOptions as t };
@@ -318,6 +318,7 @@ function lowerBlock(node, context, contentWidthPt) {
318
318
  case "tableRow":
319
319
  case "tableCell": return [];
320
320
  }
321
+ return assertNeverMarkdownBlock(node);
321
322
  }
322
323
  function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
323
324
  const sink = options.sink ?? require_diagnostics_diagnostics.NOOP_MARKDOWN_DIAGNOSTIC_SINK;
@@ -378,7 +379,11 @@ function lowerMarkdownDetailed(source, options = {}) {
378
379
  function lowerMarkdown(source, options = {}) {
379
380
  return lowerMarkdownDetailed(source, options).document;
380
381
  }
382
+ function assertNeverMarkdownBlock(node) {
383
+ throw new Error(`markdown-codec: unhandled markdown block ${JSON.stringify(node)}`);
384
+ }
381
385
  //#endregion
386
+ exports.assertNeverMarkdownBlock = assertNeverMarkdownBlock;
382
387
  exports.lowerMarkdown = lowerMarkdown;
383
388
  exports.lowerMarkdownDetailed = lowerMarkdownDetailed;
384
389
  exports.lowerParsedMarkdown = lowerParsedMarkdown;
@@ -11,5 +11,6 @@ interface LoweredMarkdownDetail {
11
11
  }
12
12
  declare function lowerMarkdownDetailed(source: string, options?: ReadMarkdownOptions): LoweredMarkdownDetail;
13
13
  declare function lowerMarkdown(source: string, options?: ReadMarkdownOptions): ContentDocument;
14
+ declare function assertNeverMarkdownBlock(node: never): never;
14
15
  //#endregion
15
- export { LoweredMarkdownDetail, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
16
+ export { LoweredMarkdownDetail, assertNeverMarkdownBlock, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
@@ -11,5 +11,6 @@ interface LoweredMarkdownDetail {
11
11
  }
12
12
  declare function lowerMarkdownDetailed(source: string, options?: ReadMarkdownOptions): LoweredMarkdownDetail;
13
13
  declare function lowerMarkdown(source: string, options?: ReadMarkdownOptions): ContentDocument;
14
+ declare function assertNeverMarkdownBlock(node: never): never;
14
15
  //#endregion
15
- export { LoweredMarkdownDetail, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
16
+ export { LoweredMarkdownDetail, assertNeverMarkdownBlock, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
@@ -317,6 +317,7 @@ function lowerBlock(node, context, contentWidthPt) {
317
317
  case "tableRow":
318
318
  case "tableCell": return [];
319
319
  }
320
+ return assertNeverMarkdownBlock(node);
320
321
  }
321
322
  function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
322
323
  const sink = options.sink ?? NOOP_MARKDOWN_DIAGNOSTIC_SINK;
@@ -377,5 +378,8 @@ function lowerMarkdownDetailed(source, options = {}) {
377
378
  function lowerMarkdown(source, options = {}) {
378
379
  return lowerMarkdownDetailed(source, options).document;
379
380
  }
381
+ function assertNeverMarkdownBlock(node) {
382
+ throw new Error(`markdown-codec: unhandled markdown block ${JSON.stringify(node)}`);
383
+ }
380
384
  //#endregion
381
- export { lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
385
+ export { assertNeverMarkdownBlock, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-codec",
3
- "version": "11.1.7",
3
+ "version": "11.1.9",
4
4
  "description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
5
5
  "type": "module",
6
6
  "repository": {
@@ -84,7 +84,7 @@
84
84
  "packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
85
85
  "dependencies": {
86
86
  "byte-codec": "2.0.1",
87
- "document-schema.js": "7.15.2",
87
+ "document-schema.js": "7.15.3",
88
88
  "zod": "4.4.3"
89
89
  },
90
90
  "devDependencies": {