@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.cjs
CHANGED
|
@@ -4988,8 +4988,20 @@ function escapeLatexPipesInUnclosed(text) {
|
|
|
4988
4988
|
const tail = text.substring(unclosedStart + delimLen);
|
|
4989
4989
|
return before + delim + replaceUnescapedPipes(tail);
|
|
4990
4990
|
}
|
|
4991
|
+
function opensMathFlow(text, pos) {
|
|
4992
|
+
let i = pos;
|
|
4993
|
+
let spaces = 0;
|
|
4994
|
+
while (i > 0 && text[i - 1] !== "\n") {
|
|
4995
|
+
i -= 1;
|
|
4996
|
+
if (text[i] !== " ") return false;
|
|
4997
|
+
spaces += 1;
|
|
4998
|
+
if (spaces > 3) return false;
|
|
4999
|
+
}
|
|
5000
|
+
return true;
|
|
5001
|
+
}
|
|
4991
5002
|
function truncateUnclosedLatexBlock(text, unclosedStart = findUnclosedDelimiterStart(text, "double-only")) {
|
|
4992
5003
|
if (unclosedStart === -1) return text;
|
|
5004
|
+
if (!opensMathFlow(text, unclosedStart)) return text;
|
|
4993
5005
|
return text.substring(0, unclosedStart).trimEnd();
|
|
4994
5006
|
}
|
|
4995
5007
|
function escapeTextUnderscores(text) {
|
|
@@ -5090,7 +5102,7 @@ function processSlice(slice, probe = true) {
|
|
|
5090
5102
|
unclosedDouble = findUnclosedDelimiterStart(text, "double-only");
|
|
5091
5103
|
if (unclosedDouble !== -1) {
|
|
5092
5104
|
quiescent = false;
|
|
5093
|
-
if (index === 0 && text.slice(0, unclosedDouble).trim() === "") {
|
|
5105
|
+
if (index === 0 && opensMathFlow(text, unclosedDouble) && text.slice(0, unclosedDouble).trim() === "") {
|
|
5094
5106
|
truncatedAtSeamStart = true;
|
|
5095
5107
|
}
|
|
5096
5108
|
}
|