@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.js
CHANGED
|
@@ -4899,8 +4899,20 @@ function escapeLatexPipesInUnclosed(text) {
|
|
|
4899
4899
|
const tail = text.substring(unclosedStart + delimLen);
|
|
4900
4900
|
return before + delim + replaceUnescapedPipes(tail);
|
|
4901
4901
|
}
|
|
4902
|
+
function opensMathFlow(text, pos) {
|
|
4903
|
+
let i = pos;
|
|
4904
|
+
let spaces = 0;
|
|
4905
|
+
while (i > 0 && text[i - 1] !== "\n") {
|
|
4906
|
+
i -= 1;
|
|
4907
|
+
if (text[i] !== " ") return false;
|
|
4908
|
+
spaces += 1;
|
|
4909
|
+
if (spaces > 3) return false;
|
|
4910
|
+
}
|
|
4911
|
+
return true;
|
|
4912
|
+
}
|
|
4902
4913
|
function truncateUnclosedLatexBlock(text, unclosedStart = findUnclosedDelimiterStart(text, "double-only")) {
|
|
4903
4914
|
if (unclosedStart === -1) return text;
|
|
4915
|
+
if (!opensMathFlow(text, unclosedStart)) return text;
|
|
4904
4916
|
return text.substring(0, unclosedStart).trimEnd();
|
|
4905
4917
|
}
|
|
4906
4918
|
function escapeTextUnderscores(text) {
|
|
@@ -5001,7 +5013,7 @@ function processSlice(slice, probe = true) {
|
|
|
5001
5013
|
unclosedDouble = findUnclosedDelimiterStart(text, "double-only");
|
|
5002
5014
|
if (unclosedDouble !== -1) {
|
|
5003
5015
|
quiescent = false;
|
|
5004
|
-
if (index === 0 && text.slice(0, unclosedDouble).trim() === "") {
|
|
5016
|
+
if (index === 0 && opensMathFlow(text, unclosedDouble) && text.slice(0, unclosedDouble).trim() === "") {
|
|
5005
5017
|
truncatedAtSeamStart = true;
|
|
5006
5018
|
}
|
|
5007
5019
|
}
|