@ai-react-markdown/engine 2.8.1 → 2.8.2
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.cjs +20 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +20 -7
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.dev.js +20 -7
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +20 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -862,7 +862,7 @@ function processConfirmedLine(cp, ln, text) {
|
|
|
862
862
|
}
|
|
863
863
|
const isBlockStart = cp.prevLineBlank;
|
|
864
864
|
if (cp.p5SealPending && !ln.blank && cp.mdBlock.kind !== "html" && !(cp.p5Tok.kind === "comment" || cp.p5Tok.kind === "bogus")) {
|
|
865
|
-
const defShapedLine = DEF_RE.test(ln.text) || FOOTNOTE_DEF_RE.test(ln.text) || cp.defBlockMaybeOpen || cp.fnDefResumable && ln.indent
|
|
865
|
+
const defShapedLine = DEF_RE.test(ln.text) || FOOTNOTE_DEF_RE.test(ln.text) || cp.defBlockMaybeOpen || cp.fnDefResumable && !(isBlockStart && ln.indent <= 3);
|
|
866
866
|
const commentOnly = ln.text.replace(/<!--[\s\S]*?-->/g, " ").replace(/<!--[\s\S]*$/, " ").replace(/[ \t\r]/g, "") === "";
|
|
867
867
|
const closeTagOnly = CLOSE_TAG_ONLY_RE.test(ln.text);
|
|
868
868
|
if (!defShapedLine && !commentOnly && !closeTagOnly) {
|
|
@@ -1066,7 +1066,7 @@ function processConfirmedLine(cp, ln, text) {
|
|
|
1066
1066
|
if (tagStart) {
|
|
1067
1067
|
const noRealBlockOpen = cp.mdBlock.kind !== "html";
|
|
1068
1068
|
const t1 = noRealBlockOpen ? TYPE1_START_RE.exec(mdTrimStart(ln.text)) : null;
|
|
1069
|
-
if (t1) cp.mdBlock = { kind: "html", type: 1, raw: RAW_TEXT_ELEMENTS.has(t1[1].toLowerCase()) };
|
|
1069
|
+
if (t1) cp.mdBlock = { kind: "html", type: 1, raw: RAW_TEXT_ELEMENTS.has(t1[1].toLowerCase()), indent: ln.indent };
|
|
1070
1070
|
if (cp.mdBlock.kind !== "html") {
|
|
1071
1071
|
const t = mdTrimStart(ln.text);
|
|
1072
1072
|
const t6 = TYPE6_START_RE.exec(t);
|
|
@@ -1081,7 +1081,7 @@ function processConfirmedLine(cp, ln, text) {
|
|
|
1081
1081
|
// raw-text names (`</style>` alone is type 7, measured) and
|
|
1082
1082
|
// quoted-`>` attribute values.
|
|
1083
1083
|
!cp.prevLineOpenContent && type7Shaped) {
|
|
1084
|
-
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: realT6 ? 6 : 7 };
|
|
1084
|
+
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: realT6 ? 6 : 7, indent: ln.indent };
|
|
1085
1085
|
} else if (cp.prevLineOpenContent && cp.tableMaybeOpen && type7Shaped) {
|
|
1086
1086
|
cp.phasePoisonedAt = Math.min(cp.phasePoisonedAt, ln.start);
|
|
1087
1087
|
}
|
|
@@ -1173,7 +1173,7 @@ function processConfirmedLine(cp, ln, text) {
|
|
|
1173
1173
|
pos = bogus + 2;
|
|
1174
1174
|
} else if (first === cd) {
|
|
1175
1175
|
rawSpans.push([cd, cd + 9]);
|
|
1176
|
-
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 5 };
|
|
1176
|
+
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 5, indent: ln.indent };
|
|
1177
1177
|
if (cp.p5Tok.kind === "data") cp.p5Tok = { kind: "bogus" };
|
|
1178
1178
|
if (!isMdBlank(scanText.slice(0, cd)) || ln.indent > 3) inlineRawOpenerIdx = cd;
|
|
1179
1179
|
pos = cd + 9;
|
|
@@ -1185,14 +1185,14 @@ function processConfirmedLine(cp, ln, text) {
|
|
|
1185
1185
|
continue;
|
|
1186
1186
|
}
|
|
1187
1187
|
rawSpans.push([pi, pi + 2]);
|
|
1188
|
-
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 3 };
|
|
1188
|
+
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 3, indent: ln.indent };
|
|
1189
1189
|
if (cp.p5Tok.kind === "data") cp.p5Tok = { kind: "bogus" };
|
|
1190
1190
|
if (!isMdBlank(scanText.slice(0, pi)) || ln.indent > 3) inlineRawOpenerIdx = pi;
|
|
1191
1191
|
pos = pi + 2;
|
|
1192
1192
|
} else {
|
|
1193
1193
|
rawSpans.push([decl, decl + 2]);
|
|
1194
1194
|
if (ln.indent <= 3 && /^doctype/i.test(scanText.slice(decl + 2))) cp.phasePoisonedAt = 0;
|
|
1195
|
-
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 4 };
|
|
1195
|
+
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 4, indent: ln.indent };
|
|
1196
1196
|
if (cp.p5Tok.kind === "data") cp.p5Tok = { kind: "bogus" };
|
|
1197
1197
|
if (!isMdBlank(scanText.slice(0, decl)) || ln.indent > 3) inlineRawOpenerIdx = decl;
|
|
1198
1198
|
pos = decl + 2;
|
|
@@ -1251,7 +1251,7 @@ function processConfirmedLine(cp, ln, text) {
|
|
|
1251
1251
|
if (next.startsWith(">") || next === "->") {
|
|
1252
1252
|
continue;
|
|
1253
1253
|
}
|
|
1254
|
-
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 2 };
|
|
1254
|
+
if (cp.mdBlock.kind === "none") cp.mdBlock = { kind: "html", type: 2, indent: ln.indent };
|
|
1255
1255
|
if (cp.p5Tok.kind === "data") cp.p5Tok = { kind: "comment" };
|
|
1256
1256
|
lastCommentOpenerIdx = m.index;
|
|
1257
1257
|
continue;
|
|
@@ -1411,6 +1411,19 @@ function processConfirmedLine(cp, ln, text) {
|
|
|
1411
1411
|
cp.defBlockMaybeOpen = cp.defBlockMaybeOpen || DEF_RE.test(ln.text) || FOOTNOTE_DEF_RE.test(ln.text);
|
|
1412
1412
|
if (FOOTNOTE_DEF_RE.test(ln.text)) cp.fnDefResumable = true;
|
|
1413
1413
|
else if (isBlockStart && ln.indent <= 3) cp.fnDefResumable = false;
|
|
1414
|
+
const isBarrier = (name) => SCOPE_BARRIER_NAMES.has(name);
|
|
1415
|
+
const topLevelHtmlBlock = cp.mdBlock.kind === "html" && cp.mdBlock.indent === 0;
|
|
1416
|
+
const confirmedBarriers = cp.openStack.filter(isBarrier).length - cp.pendingTruncatedTags.filter(isBarrier).length;
|
|
1417
|
+
if (!topLevelHtmlBlock && confirmedBarriers > 0) {
|
|
1418
|
+
cp.phasePoisonedAt = Math.min(cp.phasePoisonedAt, ln.start);
|
|
1419
|
+
}
|
|
1420
|
+
const maskUnbacked = mdType1RawText(cp.mdBlock) && !inRawTextTok(cp.p5Tok);
|
|
1421
|
+
if (maskUnbacked) {
|
|
1422
|
+
cp.phasePoisonedAt = Math.min(cp.phasePoisonedAt, ln.start);
|
|
1423
|
+
if (tailCarriesRetroactive(ln.text) || /<template(?![a-z0-9-])/i.test(ln.text)) {
|
|
1424
|
+
cp.phasePoisonedAt = 0;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1414
1427
|
}
|
|
1415
1428
|
|
|
1416
1429
|
// src/components/incrementalParse/spliceParse.ts
|