stream-markdown-parser 0.0.75 → 0.0.76
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 +11 -11
- package/dist/index.js.map +1 -1
- package/package.json +14 -12
package/dist/index.js
CHANGED
|
@@ -13396,7 +13396,6 @@ function parseInlineTokens(tokens, raw, pPreToken, options) {
|
|
|
13396
13396
|
result.push(currentTextNode);
|
|
13397
13397
|
}
|
|
13398
13398
|
function handleTextToken(token) {
|
|
13399
|
-
let index = result.length - 1;
|
|
13400
13399
|
const rawContent = String(token.content ?? "");
|
|
13401
13400
|
const rawSource = tokens.length === 1 && rawContent.includes("\\") && typeof raw === "string" ? String(raw) : "";
|
|
13402
13401
|
let content = rawSource ? decodeVisibleTextFromRaw(rawSource) : rawContent.replace(ESCAPED_PUNCTUATION_RE, "$1");
|
|
@@ -13407,17 +13406,18 @@ function parseInlineTokens(tokens, raw, pPreToken, options) {
|
|
|
13407
13406
|
const dollarIndex = content.indexOf("$");
|
|
13408
13407
|
if (dollarIndex !== -1 && dollarIndex === content.lastIndexOf("$") && content.endsWith("$")) content = content.slice(0, -1);
|
|
13409
13408
|
if (content.endsWith("undefined") && !raw?.endsWith("undefined")) content = content.slice(0, -9);
|
|
13410
|
-
|
|
13409
|
+
let trailingTextStart = result.length;
|
|
13410
|
+
let trailingTextContent = "";
|
|
13411
|
+
for (let index = result.length - 1; index >= 0; index--) {
|
|
13411
13412
|
const item = result[index];
|
|
13412
|
-
if (item.type
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
}
|
|
13420
|
-
if (index < result.length - 1) result.length = index + 1;
|
|
13413
|
+
if (item.type !== "text") break;
|
|
13414
|
+
trailingTextStart = index;
|
|
13415
|
+
trailingTextContent = String(item.content ?? "") + trailingTextContent;
|
|
13416
|
+
}
|
|
13417
|
+
if (trailingTextStart < result.length) if (content.startsWith(trailingTextContent)) {
|
|
13418
|
+
currentTextNode = null;
|
|
13419
|
+
result.length = trailingTextStart;
|
|
13420
|
+
} else currentTextNode = result[result.length - 1];
|
|
13421
13421
|
const nextToken = tokens[i + 1];
|
|
13422
13422
|
if (pPreToken?.type === "list_item_open" && /^\d$/.test(content)) {
|
|
13423
13423
|
i++;
|