markdown-codec 6.7.3 → 6.7.5

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.
Files changed (56) hide show
  1. package/README.md +2 -1
  2. package/dist/block/definitions.cjs +1 -5
  3. package/dist/block/definitions.js +1 -5
  4. package/dist/block/line.cjs +2 -2
  5. package/dist/block/line.js +2 -2
  6. package/dist/block/list.cjs +7 -14
  7. package/dist/block/list.js +7 -14
  8. package/dist/block/table.cjs +3 -4
  9. package/dist/block/table.js +3 -4
  10. package/dist/codec.d.cts +36 -36
  11. package/dist/codec.d.ts +36 -36
  12. package/dist/emit/emit.cjs +35 -37
  13. package/dist/emit/emit.js +35 -37
  14. package/dist/emit/table.cjs +2 -2
  15. package/dist/emit/table.js +2 -2
  16. package/dist/html/html.cjs +0 -2
  17. package/dist/html/html.js +0 -2
  18. package/dist/html/render.cjs +3 -11
  19. package/dist/html/render.js +3 -11
  20. package/dist/image/image.cjs +0 -49
  21. package/dist/image/image.d.cts +2 -2
  22. package/dist/image/image.d.ts +2 -2
  23. package/dist/image/image.js +1 -48
  24. package/dist/{image-BtmTG4_a.d.cts → image-83yql5ES.d.cts} +1 -3
  25. package/dist/{image-BtmTG4_a.d.ts → image-83yql5ES.d.ts} +1 -3
  26. package/dist/{image-B5L0HpAJ.d.cts → image-B6p0Ovgy.d.cts} +1 -1
  27. package/dist/{image-C390OIB3.d.ts → image-gR1vISI0.d.ts} +1 -1
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/inline/chars.cjs +3 -6
  31. package/dist/inline/chars.js +3 -6
  32. package/dist/inline/delimiter.cjs +5 -12
  33. package/dist/inline/delimiter.d.cts +2 -1
  34. package/dist/inline/delimiter.d.ts +2 -1
  35. package/dist/inline/delimiter.js +5 -13
  36. package/dist/inline/entity.cjs +6 -10
  37. package/dist/inline/entity.js +6 -10
  38. package/dist/inline/link.cjs +4 -5
  39. package/dist/inline/link.js +4 -5
  40. package/dist/lower/front-matter.cjs +4 -8
  41. package/dist/lower/front-matter.js +4 -8
  42. package/dist/lower/image.cjs +3 -2
  43. package/dist/lower/image.d.cts +1 -1
  44. package/dist/lower/image.d.ts +1 -1
  45. package/dist/lower/image.js +2 -1
  46. package/dist/lower/inline.cjs +0 -2
  47. package/dist/lower/inline.js +0 -2
  48. package/dist/options/options.d.cts +1 -1
  49. package/dist/options/options.d.ts +1 -1
  50. package/dist/read.cjs +2 -2
  51. package/dist/read.js +2 -2
  52. package/dist/scan/scan.cjs +1 -3
  53. package/dist/scan/scan.js +1 -3
  54. package/dist/shared/list-id.cjs +1 -1
  55. package/dist/shared/list-id.js +1 -1
  56. package/package.json +3 -2
@@ -63,7 +63,6 @@ function canMatch(opener, closer) {
63
63
  return !isRuleOfThreeBlocked(opener, closer);
64
64
  }
65
65
  function delimitersConsumedByMatch(opener, closer) {
66
- if (closer.char === "~") return closer.count;
67
66
  return closer.count >= 2 && opener.count >= 2 ? 2 : 1;
68
67
  }
69
68
  function wrapperKindFor(closer, used) {
@@ -83,7 +82,7 @@ function processEmphasis(stack, stackBottom, createWrapper) {
83
82
  const floor = openersFloor.has(signature) ? openersFloor.get(signature) : stackBottom;
84
83
  let opener = closer.previous;
85
84
  let matchedOpener;
86
- while (opener !== void 0 && opener !== stackBottom && opener !== floor) {
85
+ while (opener !== void 0 && opener !== floor) {
87
86
  if (canMatch(opener, closer)) {
88
87
  matchedOpener = opener;
89
88
  break;
@@ -94,7 +93,6 @@ function processEmphasis(stack, stackBottom, createWrapper) {
94
93
  if (matchedOpener === void 0) {
95
94
  closer = closer.next;
96
95
  openersFloor.set(signature, failedCloser.previous);
97
- if (!failedCloser.canOpen) stack.remove(failedCloser);
98
96
  continue;
99
97
  }
100
98
  const used = delimitersConsumedByMatch(matchedOpener, closer);
@@ -112,16 +110,10 @@ function processEmphasis(stack, stackBottom, createWrapper) {
112
110
  moving = following;
113
111
  }
114
112
  openerNode.insertAfter(wrapper);
115
- if (matchedOpener.next !== closer) {
116
- matchedOpener.next = closer;
117
- closer.previous = matchedOpener;
118
- }
119
- if (matchedOpener.count === 0) {
120
- openerNode.unlink();
121
- stack.remove(matchedOpener);
122
- }
113
+ matchedOpener.next = closer;
114
+ closer.previous = matchedOpener;
115
+ if (matchedOpener.count === 0) stack.remove(matchedOpener);
123
116
  if (closer.count === 0) {
124
- closerNode.unlink();
125
117
  const following = closer.next;
126
118
  stack.remove(closer);
127
119
  closer = following;
@@ -131,6 +123,7 @@ function processEmphasis(stack, stackBottom, createWrapper) {
131
123
  }
132
124
  //#endregion
133
125
  exports.DelimiterStack = DelimiterStack;
126
+ exports.closerSignature = closerSignature;
134
127
  exports.isDelimiterChar = isDelimiterChar;
135
128
  exports.processEmphasis = processEmphasis;
136
129
  exports.scanDelimiterRun = scanDelimiterRun;
@@ -23,7 +23,8 @@ declare class DelimiterStack {
23
23
  push(char: DelimiterChar, run: DelimiterRun, node: InlineNode): void;
24
24
  remove(delimiter: Delimiter): void;
25
25
  }
26
+ declare function closerSignature(closer: Delimiter): string;
26
27
  type EmphasisWrapperFactory = (kind: "emphasis" | "strong" | "strikethrough", marker: DelimiterChar) => InlineNode;
27
28
  declare function processEmphasis(stack: DelimiterStack, stackBottom: Delimiter | undefined, createWrapper: EmphasisWrapperFactory): void;
28
29
  //#endregion
29
- export { Delimiter, DelimiterChar, DelimiterRun, DelimiterStack, EmphasisWrapperFactory, isDelimiterChar, processEmphasis, scanDelimiterRun };
30
+ export { Delimiter, DelimiterChar, DelimiterRun, DelimiterStack, EmphasisWrapperFactory, closerSignature, isDelimiterChar, processEmphasis, scanDelimiterRun };
@@ -23,7 +23,8 @@ declare class DelimiterStack {
23
23
  push(char: DelimiterChar, run: DelimiterRun, node: InlineNode): void;
24
24
  remove(delimiter: Delimiter): void;
25
25
  }
26
+ declare function closerSignature(closer: Delimiter): string;
26
27
  type EmphasisWrapperFactory = (kind: "emphasis" | "strong" | "strikethrough", marker: DelimiterChar) => InlineNode;
27
28
  declare function processEmphasis(stack: DelimiterStack, stackBottom: Delimiter | undefined, createWrapper: EmphasisWrapperFactory): void;
28
29
  //#endregion
29
- export { Delimiter, DelimiterChar, DelimiterRun, DelimiterStack, EmphasisWrapperFactory, isDelimiterChar, processEmphasis, scanDelimiterRun };
30
+ export { Delimiter, DelimiterChar, DelimiterRun, DelimiterStack, EmphasisWrapperFactory, closerSignature, isDelimiterChar, processEmphasis, scanDelimiterRun };
@@ -62,7 +62,6 @@ function canMatch(opener, closer) {
62
62
  return !isRuleOfThreeBlocked(opener, closer);
63
63
  }
64
64
  function delimitersConsumedByMatch(opener, closer) {
65
- if (closer.char === "~") return closer.count;
66
65
  return closer.count >= 2 && opener.count >= 2 ? 2 : 1;
67
66
  }
68
67
  function wrapperKindFor(closer, used) {
@@ -82,7 +81,7 @@ function processEmphasis(stack, stackBottom, createWrapper) {
82
81
  const floor = openersFloor.has(signature) ? openersFloor.get(signature) : stackBottom;
83
82
  let opener = closer.previous;
84
83
  let matchedOpener;
85
- while (opener !== void 0 && opener !== stackBottom && opener !== floor) {
84
+ while (opener !== void 0 && opener !== floor) {
86
85
  if (canMatch(opener, closer)) {
87
86
  matchedOpener = opener;
88
87
  break;
@@ -93,7 +92,6 @@ function processEmphasis(stack, stackBottom, createWrapper) {
93
92
  if (matchedOpener === void 0) {
94
93
  closer = closer.next;
95
94
  openersFloor.set(signature, failedCloser.previous);
96
- if (!failedCloser.canOpen) stack.remove(failedCloser);
97
95
  continue;
98
96
  }
99
97
  const used = delimitersConsumedByMatch(matchedOpener, closer);
@@ -111,16 +109,10 @@ function processEmphasis(stack, stackBottom, createWrapper) {
111
109
  moving = following;
112
110
  }
113
111
  openerNode.insertAfter(wrapper);
114
- if (matchedOpener.next !== closer) {
115
- matchedOpener.next = closer;
116
- closer.previous = matchedOpener;
117
- }
118
- if (matchedOpener.count === 0) {
119
- openerNode.unlink();
120
- stack.remove(matchedOpener);
121
- }
112
+ matchedOpener.next = closer;
113
+ closer.previous = matchedOpener;
114
+ if (matchedOpener.count === 0) stack.remove(matchedOpener);
122
115
  if (closer.count === 0) {
123
- closerNode.unlink();
124
116
  const following = closer.next;
125
117
  stack.remove(closer);
126
118
  closer = following;
@@ -129,4 +121,4 @@ function processEmphasis(stack, stackBottom, createWrapper) {
129
121
  while (stack.top !== void 0 && stack.top !== stackBottom) stack.remove(stack.top);
130
122
  }
131
123
  //#endregion
132
- export { DelimiterStack, isDelimiterChar, processEmphasis, scanDelimiterRun };
124
+ export { DelimiterStack, closerSignature, isDelimiterChar, processEmphasis, scanDelimiterRun };
@@ -12,7 +12,6 @@ function codepointToString(codepoint) {
12
12
  return String.fromCodePoint(codepoint);
13
13
  }
14
14
  function matchEntity(text, start) {
15
- if (text.charAt(start) !== "&") return;
16
15
  const match = ENTITY_PATTERN.exec(text.slice(start));
17
16
  if (match === null) return;
18
17
  const [raw, hex, decimal, name] = match;
@@ -33,10 +32,9 @@ function matchEntity(text, start) {
33
32
  };
34
33
  }
35
34
  function unescapeString(text) {
36
- if (!text.includes("\\") && !text.includes("&")) return text;
37
35
  let result = "";
38
36
  let index = 0;
39
- while (index < text.length) {
37
+ while (text.charAt(index) !== "") {
40
38
  const char = text.charAt(index);
41
39
  if (char === "\\") {
42
40
  const next = text.charAt(index + 1);
@@ -49,13 +47,11 @@ function unescapeString(text) {
49
47
  index += 1;
50
48
  continue;
51
49
  }
52
- if (char === "&") {
53
- const entity = matchEntity(text, index);
54
- if (entity !== void 0) {
55
- result += entity.value;
56
- index += entity.raw.length;
57
- continue;
58
- }
50
+ const entity = matchEntity(text, index);
51
+ if (entity !== void 0) {
52
+ result += entity.value;
53
+ index += entity.raw.length;
54
+ continue;
59
55
  }
60
56
  result += char;
61
57
  index += 1;
@@ -11,7 +11,6 @@ function codepointToString(codepoint) {
11
11
  return String.fromCodePoint(codepoint);
12
12
  }
13
13
  function matchEntity(text, start) {
14
- if (text.charAt(start) !== "&") return;
15
14
  const match = ENTITY_PATTERN.exec(text.slice(start));
16
15
  if (match === null) return;
17
16
  const [raw, hex, decimal, name] = match;
@@ -32,10 +31,9 @@ function matchEntity(text, start) {
32
31
  };
33
32
  }
34
33
  function unescapeString(text) {
35
- if (!text.includes("\\") && !text.includes("&")) return text;
36
34
  let result = "";
37
35
  let index = 0;
38
- while (index < text.length) {
36
+ while (text.charAt(index) !== "") {
39
37
  const char = text.charAt(index);
40
38
  if (char === "\\") {
41
39
  const next = text.charAt(index + 1);
@@ -48,13 +46,11 @@ function unescapeString(text) {
48
46
  index += 1;
49
47
  continue;
50
48
  }
51
- if (char === "&") {
52
- const entity = matchEntity(text, index);
53
- if (entity !== void 0) {
54
- result += entity.value;
55
- index += entity.raw.length;
56
- continue;
57
- }
49
+ const entity = matchEntity(text, index);
50
+ if (entity !== void 0) {
51
+ result += entity.value;
52
+ index += entity.raw.length;
53
+ continue;
58
54
  }
59
55
  result += char;
60
56
  index += 1;
@@ -9,7 +9,7 @@ function normalizeLinkLabel(labelWithBrackets) {
9
9
  function matchLinkLabel(text, start) {
10
10
  if (text.charAt(start) !== "[") return 0;
11
11
  let index = start + 1;
12
- while (index < text.length) {
12
+ while (text.charAt(index) !== "") {
13
13
  const char = text.charAt(index);
14
14
  if (char === "\\") {
15
15
  index += 2;
@@ -27,7 +27,7 @@ function matchLinkLabel(text, start) {
27
27
  function parseLinkDestination(text, start) {
28
28
  if (text.charAt(start) === "<") {
29
29
  let index = start + 1;
30
- while (index < text.length) {
30
+ while (text.charAt(index) !== "") {
31
31
  const char = text.charAt(index);
32
32
  if (char === "\\") {
33
33
  index += 2;
@@ -79,9 +79,8 @@ const TITLE_DELIMITERS = /* @__PURE__ */ new Map([
79
79
  function parseLinkTitle(text, start) {
80
80
  const opener = text.charAt(start);
81
81
  const closer = TITLE_DELIMITERS.get(opener);
82
- if (closer === void 0) return;
83
82
  let index = start + 1;
84
- while (index < text.length) {
83
+ while (text.charAt(index) !== "") {
85
84
  const char = text.charAt(index);
86
85
  if (char === "\\") {
87
86
  index += 2;
@@ -98,7 +97,7 @@ function parseLinkTitle(text, start) {
98
97
  function skipInlineWhitespace(text, start) {
99
98
  let index = start;
100
99
  let seenLineEnding = false;
101
- while (index < text.length) {
100
+ for (;;) {
102
101
  const char = text.charAt(index);
103
102
  if (char === "\n") {
104
103
  if (seenLineEnding) break;
@@ -8,7 +8,7 @@ function normalizeLinkLabel(labelWithBrackets) {
8
8
  function matchLinkLabel(text, start) {
9
9
  if (text.charAt(start) !== "[") return 0;
10
10
  let index = start + 1;
11
- while (index < text.length) {
11
+ while (text.charAt(index) !== "") {
12
12
  const char = text.charAt(index);
13
13
  if (char === "\\") {
14
14
  index += 2;
@@ -26,7 +26,7 @@ function matchLinkLabel(text, start) {
26
26
  function parseLinkDestination(text, start) {
27
27
  if (text.charAt(start) === "<") {
28
28
  let index = start + 1;
29
- while (index < text.length) {
29
+ while (text.charAt(index) !== "") {
30
30
  const char = text.charAt(index);
31
31
  if (char === "\\") {
32
32
  index += 2;
@@ -78,9 +78,8 @@ const TITLE_DELIMITERS = /* @__PURE__ */ new Map([
78
78
  function parseLinkTitle(text, start) {
79
79
  const opener = text.charAt(start);
80
80
  const closer = TITLE_DELIMITERS.get(opener);
81
- if (closer === void 0) return;
82
81
  let index = start + 1;
83
- while (index < text.length) {
82
+ while (text.charAt(index) !== "") {
84
83
  const char = text.charAt(index);
85
84
  if (char === "\\") {
86
85
  index += 2;
@@ -97,7 +96,7 @@ function parseLinkTitle(text, start) {
97
96
  function skipInlineWhitespace(text, start) {
98
97
  let index = start;
99
98
  let seenLineEnding = false;
100
- while (index < text.length) {
99
+ for (;;) {
101
100
  const char = text.charAt(index);
102
101
  if (char === "\n") {
103
102
  if (seenLineEnding) break;
@@ -73,20 +73,16 @@ function extractFrontMatter(source, sink = require_diagnostics_diagnostics.NOOP_
73
73
  rest: source,
74
74
  source: void 0
75
75
  };
76
- let closingIndex = -1;
77
- for (let index = 1; index < lines.length; index += 1) if (CLOSING_DELIMITER_PATTERN.test(lines[index] ?? "")) {
78
- closingIndex = index;
79
- break;
80
- }
76
+ const closingOffset = lines.slice(1).findIndex((line) => CLOSING_DELIMITER_PATTERN.test(line));
77
+ const closingIndex = closingOffset === -1 ? -1 : closingOffset + 1;
81
78
  if (closingIndex === -1) return {
82
79
  metadata: {},
83
80
  rest: source,
84
81
  source: void 0
85
82
  };
86
83
  const metadata = {};
87
- for (let index = 1; index < closingIndex; index += 1) {
88
- const line = lines[index] ?? "";
89
- if (line.trim().length === 0) continue;
84
+ for (const [offset, line] of lines.slice(1, closingIndex).entries()) {
85
+ const index = offset + 1;
90
86
  const match = KEY_VALUE_LINE_PATTERN.exec(line);
91
87
  const key = match?.[1];
92
88
  const value = match?.[2];
@@ -72,20 +72,16 @@ function extractFrontMatter(source, sink = NOOP_MARKDOWN_DIAGNOSTIC_SINK) {
72
72
  rest: source,
73
73
  source: void 0
74
74
  };
75
- let closingIndex = -1;
76
- for (let index = 1; index < lines.length; index += 1) if (CLOSING_DELIMITER_PATTERN.test(lines[index] ?? "")) {
77
- closingIndex = index;
78
- break;
79
- }
75
+ const closingOffset = lines.slice(1).findIndex((line) => CLOSING_DELIMITER_PATTERN.test(line));
76
+ const closingIndex = closingOffset === -1 ? -1 : closingOffset + 1;
80
77
  if (closingIndex === -1) return {
81
78
  metadata: {},
82
79
  rest: source,
83
80
  source: void 0
84
81
  };
85
82
  const metadata = {};
86
- for (let index = 1; index < closingIndex; index += 1) {
87
- const line = lines[index] ?? "";
88
- if (line.trim().length === 0) continue;
83
+ for (const [offset, line] of lines.slice(1, closingIndex).entries()) {
84
+ const index = offset + 1;
89
85
  const match = KEY_VALUE_LINE_PATTERN.exec(line);
90
86
  const key = match?.[1];
91
87
  const value = match?.[2];
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_image_image = require("../image/image.cjs");
3
+ let byte_codec = require("byte-codec");
3
4
  //#region src/lower/image.ts
4
5
  const POINTS_PER_PIXEL = 72 / 96;
5
6
  const DATA_URI_PATTERN = /^data:image\/(?:png|jpe?g);base64,(.+)$/is;
@@ -7,7 +8,7 @@ function decodeDataUriImage(destination) {
7
8
  const base64 = DATA_URI_PATTERN.exec(destination)?.[1];
8
9
  if (base64 === void 0) return;
9
10
  try {
10
- return require_image_image.base64ToBytes(base64);
11
+ return (0, byte_codec.base64ToBytes)(base64);
11
12
  } catch {
12
13
  return;
13
14
  }
@@ -20,7 +21,7 @@ function resolveMarkdownImage(destination, context, resolver) {
20
21
  if (format === void 0 || dimensions === void 0) return;
21
22
  return {
22
23
  format,
23
- base64: require_image_image.bytesToBase64(bytes),
24
+ base64: (0, byte_codec.bytesToBase64)(bytes),
24
25
  widthPt: dimensions.widthPx * POINTS_PER_PIXEL,
25
26
  heightPt: dimensions.heightPx * POINTS_PER_PIXEL
26
27
  };
@@ -1,2 +1,2 @@
1
- import { a as resolveMarkdownImage, i as ResolvedMarkdownImage, n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "../image-B5L0HpAJ.cjs";
1
+ import { a as resolveMarkdownImage, i as ResolvedMarkdownImage, n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "../image-B6p0Ovgy.cjs";
2
2
  export { MarkdownImageResolveContext, MarkdownImageResolver, MarkdownResolvedImageBytes, ResolvedMarkdownImage, resolveMarkdownImage };
@@ -1,2 +1,2 @@
1
- import { a as resolveMarkdownImage, i as ResolvedMarkdownImage, n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "../image-C390OIB3.js";
1
+ import { a as resolveMarkdownImage, i as ResolvedMarkdownImage, n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "../image-gR1vISI0.js";
2
2
  export { MarkdownImageResolveContext, MarkdownImageResolver, MarkdownResolvedImageBytes, ResolvedMarkdownImage, resolveMarkdownImage };
@@ -1,4 +1,5 @@
1
- import { base64ToBytes, bytesToBase64, detectImageFormat, readImageDimensions } from "../image/image.js";
1
+ import { detectImageFormat, readImageDimensions } from "../image/image.js";
2
+ import { base64ToBytes, bytesToBase64 } from "byte-codec";
2
3
  //#region src/lower/image.ts
3
4
  const POINTS_PER_PIXEL = 72 / 96;
4
5
  const DATA_URI_PATTERN = /^data:image\/(?:png|jpe?g);base64,(.+)$/is;
@@ -27,8 +27,6 @@ function lowerNestedEmphasisLike(kind, node, style, context, runs, extents) {
27
27
  function lowerInlineNodeInto(node, style, context, runs, extents) {
28
28
  switch (node.type) {
29
29
  case "text":
30
- if (node.value.length > 0) runs.push(buildRun(node.value, style));
31
- return;
32
30
  case "entity":
33
31
  if (node.value.length > 0) runs.push(buildRun(node.value, style));
34
32
  return;
@@ -26,8 +26,6 @@ function lowerNestedEmphasisLike(kind, node, style, context, runs, extents) {
26
26
  function lowerInlineNodeInto(node, style, context, runs, extents) {
27
27
  switch (node.type) {
28
28
  case "text":
29
- if (node.value.length > 0) runs.push(buildRun(node.value, style));
30
- return;
31
29
  case "entity":
32
30
  if (node.value.length > 0) runs.push(buildRun(node.value, style));
33
31
  return;
@@ -1,5 +1,5 @@
1
1
  import { i as MarkdownDiagnosticSink } from "../diagnostics-CjfBoW4K.cjs";
2
- import { n as MarkdownImageResolver } from "../image-B5L0HpAJ.cjs";
2
+ import { n as MarkdownImageResolver } from "../image-B6p0Ovgy.cjs";
3
3
  import { Margins, PageSize } from "document-schema.js";
4
4
  //#region src/options/options.d.ts
5
5
  interface ReadMarkdownOptions {
@@ -1,5 +1,5 @@
1
1
  import { i as MarkdownDiagnosticSink } from "../diagnostics-CjfBoW4K.js";
2
- import { n as MarkdownImageResolver } from "../image-C390OIB3.js";
2
+ import { n as MarkdownImageResolver } from "../image-gR1vISI0.js";
3
3
  import { Margins, PageSize } from "document-schema.js";
4
4
  //#region src/options/options.d.ts
5
5
  interface ReadMarkdownOptions {
package/dist/read.cjs CHANGED
@@ -39,14 +39,14 @@ function readMarkdown(text, options = {}) {
39
39
  xml: detail.frontMatterSource
40
40
  };
41
41
  return {
42
- documentPackage: definitions === void 0 && frontMatterResidue === void 0 ? assembled : {
42
+ documentPackage: {
43
43
  ...assembled,
44
44
  ...definitions !== void 0 ? { definitions: {
45
45
  ...assembled.definitions,
46
46
  ...definitions
47
47
  } } : {},
48
48
  ...frontMatterResidue !== void 0 ? { source: {
49
- ...assembled.source ?? {},
49
+ ...assembled.source,
50
50
  frontmatter: frontMatterResidue
51
51
  } } : {}
52
52
  },
package/dist/read.js CHANGED
@@ -38,14 +38,14 @@ function readMarkdown(text, options = {}) {
38
38
  xml: detail.frontMatterSource
39
39
  };
40
40
  return {
41
- documentPackage: definitions === void 0 && frontMatterResidue === void 0 ? assembled : {
41
+ documentPackage: {
42
42
  ...assembled,
43
43
  ...definitions !== void 0 ? { definitions: {
44
44
  ...assembled.definitions,
45
45
  ...definitions
46
46
  } } : {},
47
47
  ...frontMatterResidue !== void 0 ? { source: {
48
- ...assembled.source ?? {},
48
+ ...assembled.source,
49
49
  frontmatter: frontMatterResidue
50
50
  } } : {}
51
51
  },
@@ -18,11 +18,9 @@ var MarkdownScanCursor = class {
18
18
  };
19
19
  }
20
20
  atEnd() {
21
- return this.pendingTabColumns === 0 && this.rawOffset >= this.source.length;
21
+ return this.rawOffset >= this.source.length;
22
22
  }
23
23
  peek() {
24
- if (this.pendingTabColumns > 0) return " ";
25
- if (this.rawOffset >= this.source.length) return;
26
24
  const char = this.source[this.rawOffset];
27
25
  if (char === " ") return " ";
28
26
  if (char === "\r") return "\n";
package/dist/scan/scan.js CHANGED
@@ -17,11 +17,9 @@ var MarkdownScanCursor = class {
17
17
  };
18
18
  }
19
19
  atEnd() {
20
- return this.pendingTabColumns === 0 && this.rawOffset >= this.source.length;
20
+ return this.rawOffset >= this.source.length;
21
21
  }
22
22
  peek() {
23
- if (this.pendingTabColumns > 0) return " ";
24
- if (this.rawOffset >= this.source.length) return;
25
23
  const char = this.source[this.rawOffset];
26
24
  if (char === " ") return " ";
27
25
  if (char === "\r") return "\n";
@@ -18,7 +18,7 @@ function parseListNumId(numId) {
18
18
  const match = NUMID_PATTERN.exec(numId);
19
19
  if (match === null) return;
20
20
  const type = match[2];
21
- if (type === void 0 || type !== "bullet" && type !== "ordered") return;
21
+ if (type !== "bullet" && type !== "ordered") return;
22
22
  const startText = match[3];
23
23
  return {
24
24
  type,
@@ -17,7 +17,7 @@ function parseListNumId(numId) {
17
17
  const match = NUMID_PATTERN.exec(numId);
18
18
  if (match === null) return;
19
19
  const type = match[2];
20
- if (type === void 0 || type !== "bullet" && type !== "ordered") return;
20
+ if (type !== "bullet" && type !== "ordered") return;
21
21
  const startText = match[3];
22
22
  return {
23
23
  type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-codec",
3
- "version": "6.7.3",
3
+ "version": "6.7.5",
4
4
  "description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
5
5
  "type": "module",
6
6
  "repository": {
@@ -83,7 +83,8 @@
83
83
  "license": "MIT",
84
84
  "packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
85
85
  "dependencies": {
86
- "document-schema.js": "7.11.3",
86
+ "byte-codec": "1.6.1",
87
+ "document-schema.js": "7.11.4",
87
88
  "zod": "4.4.3"
88
89
  },
89
90
  "devDependencies": {