@ai-react-markdown/engine 2.10.0 → 2.10.1
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 +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +13 -1
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.dev.js +13 -1
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.dev.js
CHANGED
|
@@ -4918,8 +4918,20 @@ function escapeLatexPipesInUnclosed(text) {
|
|
|
4918
4918
|
const tail = text.substring(unclosedStart + delimLen);
|
|
4919
4919
|
return before + delim + replaceUnescapedPipes(tail);
|
|
4920
4920
|
}
|
|
4921
|
+
function opensMathFlow(text, pos) {
|
|
4922
|
+
let i = pos;
|
|
4923
|
+
let spaces = 0;
|
|
4924
|
+
while (i > 0 && text[i - 1] !== "\n") {
|
|
4925
|
+
i -= 1;
|
|
4926
|
+
if (text[i] !== " ") return false;
|
|
4927
|
+
spaces += 1;
|
|
4928
|
+
if (spaces > 3) return false;
|
|
4929
|
+
}
|
|
4930
|
+
return true;
|
|
4931
|
+
}
|
|
4921
4932
|
function truncateUnclosedLatexBlock(text, unclosedStart = findUnclosedDelimiterStart(text, "double-only")) {
|
|
4922
4933
|
if (unclosedStart === -1) return text;
|
|
4934
|
+
if (!opensMathFlow(text, unclosedStart)) return text;
|
|
4923
4935
|
return text.substring(0, unclosedStart).trimEnd();
|
|
4924
4936
|
}
|
|
4925
4937
|
function escapeTextUnderscores(text) {
|
|
@@ -5020,7 +5032,7 @@ function processSlice(slice, probe = true) {
|
|
|
5020
5032
|
unclosedDouble = findUnclosedDelimiterStart(text, "double-only");
|
|
5021
5033
|
if (unclosedDouble !== -1) {
|
|
5022
5034
|
quiescent = false;
|
|
5023
|
-
if (index === 0 && text.slice(0, unclosedDouble).trim() === "") {
|
|
5035
|
+
if (index === 0 && opensMathFlow(text, unclosedDouble) && text.slice(0, unclosedDouble).trim() === "") {
|
|
5024
5036
|
truncatedAtSeamStart = true;
|
|
5025
5037
|
}
|
|
5026
5038
|
}
|