stream-markdown-parser 0.0.37 → 0.0.38
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/dist/index.js +8 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7167,10 +7167,9 @@ function fixLinkToken(tokens) {
|
|
|
7167
7167
|
}
|
|
7168
7168
|
}
|
|
7169
7169
|
if (curToken.type === "link_close" && curToken.nesting === -1 && tokens[i + 1]?.type === "text" && tokens[i - 1]?.type === "text") {
|
|
7170
|
-
let loading = true;
|
|
7171
7170
|
const text$1 = tokens[i - 1].content || "";
|
|
7172
7171
|
const attrs = tokens[i - 2].attrs || [];
|
|
7173
|
-
|
|
7172
|
+
const href = attrs.find((a) => a[0] === "href")?.[1] || "";
|
|
7174
7173
|
const title = attrs.find((a) => a[0] === "title")?.[1] || "";
|
|
7175
7174
|
let count = 3;
|
|
7176
7175
|
let deleteCount = 2;
|
|
@@ -7181,37 +7180,22 @@ function fixLinkToken(tokens) {
|
|
|
7181
7180
|
const type = emphasisMatch[1].length;
|
|
7182
7181
|
pushEmOpen(replacerTokens, type);
|
|
7183
7182
|
}
|
|
7184
|
-
if (curToken.markup
|
|
7185
|
-
if (curToken.markup === "linkify" && tokens[i + 1]?.type === "text" && !tokens[i + 1]?.content?.startsWith(" ")) {
|
|
7186
|
-
const m = (tokens[i + 1]?.content ?? "").indexOf(")");
|
|
7187
|
-
if (m === -1) {
|
|
7188
|
-
href += tokens[i + 1]?.content?.slice(0, m) || "";
|
|
7189
|
-
tokens[i + 1].content = "";
|
|
7190
|
-
count += 1;
|
|
7191
|
-
} else loading = false;
|
|
7192
|
-
} else if (tokens[i + 1].type === "text" && tokens[i + 1]?.content?.startsWith("](")) {
|
|
7183
|
+
if (curToken.markup !== "linkify" && tokens[i + 1].type === "text" && tokens[i + 1]?.content?.startsWith("](")) {
|
|
7193
7184
|
count += 1;
|
|
7194
7185
|
for (let j = i + 1; j < tokens.length; j++) {
|
|
7195
7186
|
const type = emphasisMatch ? emphasisMatch[1].length : tokens[i - 3].markup.length;
|
|
7196
7187
|
const t = tokens[j];
|
|
7197
|
-
if (type === 1 && t.type === "em_close")
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
loading = false;
|
|
7202
|
-
break;
|
|
7203
|
-
} else if (type === 3) {
|
|
7204
|
-
if (t.type === "em_close" || t.type === "strong_close") {
|
|
7205
|
-
loading = false;
|
|
7206
|
-
break;
|
|
7207
|
-
}
|
|
7188
|
+
if (type === 1 && t.type === "em_close") break;
|
|
7189
|
+
else if (type === 2 && t.type === "strong_close") break;
|
|
7190
|
+
else if (type === 3) {
|
|
7191
|
+
if (t.type === "em_close" || t.type === "strong_close") break;
|
|
7208
7192
|
}
|
|
7209
7193
|
count += 1;
|
|
7210
7194
|
}
|
|
7211
|
-
}
|
|
7195
|
+
}
|
|
7212
7196
|
replacerTokens.push({
|
|
7213
7197
|
type: "link",
|
|
7214
|
-
loading,
|
|
7198
|
+
loading: false,
|
|
7215
7199
|
href,
|
|
7216
7200
|
title,
|
|
7217
7201
|
text: text$1,
|