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.
- package/README.md +2 -1
- package/dist/block/definitions.cjs +1 -5
- package/dist/block/definitions.js +1 -5
- package/dist/block/line.cjs +2 -2
- package/dist/block/line.js +2 -2
- package/dist/block/list.cjs +7 -14
- package/dist/block/list.js +7 -14
- package/dist/block/table.cjs +3 -4
- package/dist/block/table.js +3 -4
- package/dist/codec.d.cts +36 -36
- package/dist/codec.d.ts +36 -36
- package/dist/emit/emit.cjs +35 -37
- package/dist/emit/emit.js +35 -37
- package/dist/emit/table.cjs +2 -2
- package/dist/emit/table.js +2 -2
- package/dist/html/html.cjs +0 -2
- package/dist/html/html.js +0 -2
- package/dist/html/render.cjs +3 -11
- package/dist/html/render.js +3 -11
- package/dist/image/image.cjs +0 -49
- package/dist/image/image.d.cts +2 -2
- package/dist/image/image.d.ts +2 -2
- package/dist/image/image.js +1 -48
- package/dist/{image-BtmTG4_a.d.cts → image-83yql5ES.d.cts} +1 -3
- package/dist/{image-BtmTG4_a.d.ts → image-83yql5ES.d.ts} +1 -3
- package/dist/{image-B5L0HpAJ.d.cts → image-B6p0Ovgy.d.cts} +1 -1
- package/dist/{image-C390OIB3.d.ts → image-gR1vISI0.d.ts} +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/inline/chars.cjs +3 -6
- package/dist/inline/chars.js +3 -6
- package/dist/inline/delimiter.cjs +5 -12
- package/dist/inline/delimiter.d.cts +2 -1
- package/dist/inline/delimiter.d.ts +2 -1
- package/dist/inline/delimiter.js +5 -13
- package/dist/inline/entity.cjs +6 -10
- package/dist/inline/entity.js +6 -10
- package/dist/inline/link.cjs +4 -5
- package/dist/inline/link.js +4 -5
- package/dist/lower/front-matter.cjs +4 -8
- package/dist/lower/front-matter.js +4 -8
- package/dist/lower/image.cjs +3 -2
- package/dist/lower/image.d.cts +1 -1
- package/dist/lower/image.d.ts +1 -1
- package/dist/lower/image.js +2 -1
- package/dist/lower/inline.cjs +0 -2
- package/dist/lower/inline.js +0 -2
- package/dist/options/options.d.cts +1 -1
- package/dist/options/options.d.ts +1 -1
- package/dist/read.cjs +2 -2
- package/dist/read.js +2 -2
- package/dist/scan/scan.cjs +1 -3
- package/dist/scan/scan.js +1 -3
- package/dist/shared/list-id.cjs +1 -1
- package/dist/shared/list-id.js +1 -1
- 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 !==
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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 };
|
package/dist/inline/delimiter.js
CHANGED
|
@@ -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 !==
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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 };
|
package/dist/inline/entity.cjs
CHANGED
|
@@ -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
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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;
|
package/dist/inline/entity.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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;
|
package/dist/inline/link.cjs
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
100
|
+
for (;;) {
|
|
102
101
|
const char = text.charAt(index);
|
|
103
102
|
if (char === "\n") {
|
|
104
103
|
if (seenLineEnding) break;
|
package/dist/inline/link.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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 (
|
|
88
|
-
const
|
|
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
|
-
|
|
76
|
-
|
|
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 (
|
|
87
|
-
const
|
|
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];
|
package/dist/lower/image.cjs
CHANGED
|
@@ -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
|
|
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:
|
|
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
|
};
|
package/dist/lower/image.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveMarkdownImage, i as ResolvedMarkdownImage, n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "../image-
|
|
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 };
|
package/dist/lower/image.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveMarkdownImage, i as ResolvedMarkdownImage, n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "../image-
|
|
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 };
|
package/dist/lower/image.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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;
|
package/dist/lower/inline.cjs
CHANGED
|
@@ -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;
|
package/dist/lower/inline.js
CHANGED
|
@@ -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-
|
|
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-
|
|
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:
|
|
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:
|
|
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
|
},
|
package/dist/scan/scan.cjs
CHANGED
|
@@ -18,11 +18,9 @@ var MarkdownScanCursor = class {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
atEnd() {
|
|
21
|
-
return this.
|
|
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.
|
|
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";
|
package/dist/shared/list-id.cjs
CHANGED
|
@@ -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
|
|
21
|
+
if (type !== "bullet" && type !== "ordered") return;
|
|
22
22
|
const startText = match[3];
|
|
23
23
|
return {
|
|
24
24
|
type,
|
package/dist/shared/list-id.js
CHANGED
|
@@ -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
|
|
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
|
+
"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
|
-
"
|
|
86
|
+
"byte-codec": "1.6.1",
|
|
87
|
+
"document-schema.js": "7.11.4",
|
|
87
88
|
"zod": "4.4.3"
|
|
88
89
|
},
|
|
89
90
|
"devDependencies": {
|