stream-markdown-parser 0.0.58-beta.4 → 0.0.58-beta.6
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 +10 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7324,9 +7324,12 @@ function applyFixHtmlInlineTokens(md, options = {}) {
|
|
|
7324
7324
|
if (t.type === "html_block") {
|
|
7325
7325
|
const rawContent = String(t.content || "");
|
|
7326
7326
|
const tag = (rawContent.match(/<\s*(?:\/\s*)?([^\s>/]+)/)?.[1] ?? "").toLowerCase();
|
|
7327
|
-
|
|
7327
|
+
const isClosingTag$1 = /^\s*<\s*\//.test(rawContent);
|
|
7328
|
+
if (!tag || !customTagSet.has(tag)) continue;
|
|
7329
|
+
if (!isClosingTag$1) {
|
|
7328
7330
|
if (tag) {
|
|
7329
|
-
|
|
7331
|
+
const closeRe = new RegExp(`<\\s*\\/\\s*${tag}\\s*>`, "i");
|
|
7332
|
+
if (!new RegExp(`^\\s*<\\s*${tag}\\b[^>]*\\/\\s*>`, "i").test(rawContent) && !closeRe.test(rawContent)) tagStack.push([tag, i]);
|
|
7330
7333
|
}
|
|
7331
7334
|
} else if (tagStack.length > 0 && tag && tagStack[tagStack.length - 1][0] === tag) {
|
|
7332
7335
|
const [, openIndex] = tagStack[tagStack.length - 1];
|
|
@@ -8696,10 +8699,13 @@ function applyMath(md, mathOpts) {
|
|
|
8696
8699
|
lastIndex = index;
|
|
8697
8700
|
lastSearchPos = searchPos;
|
|
8698
8701
|
}
|
|
8699
|
-
if (index > 0) {
|
|
8702
|
+
if (open === "(" && index > 0) {
|
|
8700
8703
|
let i = index - 1;
|
|
8701
8704
|
while (i >= 0 && src[i] === " ") i--;
|
|
8702
|
-
if (i >= 0 && src[i] === "]")
|
|
8705
|
+
if (i >= 0 && src[i] === "]") {
|
|
8706
|
+
searchPos = index + open.length;
|
|
8707
|
+
continue;
|
|
8708
|
+
}
|
|
8703
8709
|
}
|
|
8704
8710
|
const endIdx = findMatchingClose_default(src, index + open.length, open, close);
|
|
8705
8711
|
if (endIdx === -1) {
|