@ai-matrx/content-ir 0.18.3 → 0.18.4
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/CHANGELOG.md +22 -0
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +9 -1
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +14 -1
- package/dist/source.d.ts +14 -1
- package/dist/source.js +9 -2
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.cjs
CHANGED
|
@@ -801,6 +801,12 @@ function singleDollarMathEnd(text, open, limit = text.length) {
|
|
|
801
801
|
const content = text.slice(open + 1, close);
|
|
802
802
|
return isSingleDollarMath(content, text[close + 1]) ? close + 1 : -1;
|
|
803
803
|
}
|
|
804
|
+
var BRACKET_TEX_SIGNAL = /\\[A-Za-z]+|[\^{}=<>+]|_\{|(?:^|[^A-Za-z0-9])[A-Za-z]_[A-Za-z0-9](?![A-Za-z0-9])/;
|
|
805
|
+
function isEscapedBracketMath(content, before) {
|
|
806
|
+
if (!content.trim()) return false;
|
|
807
|
+
if (before !== void 0 && /[A-Za-z0-9_)\]]/.test(before)) return false;
|
|
808
|
+
return BRACKET_TEX_SIGNAL.test(content);
|
|
809
|
+
}
|
|
804
810
|
|
|
805
811
|
// source/xml-tag.ts
|
|
806
812
|
var XML_NAME_START = /[A-Za-z_]/;
|
|
@@ -1857,7 +1863,8 @@ var Tokenizer = class {
|
|
|
1857
1863
|
const nextCh = text[i + 1];
|
|
1858
1864
|
if (nextCh === "(" || nextCh === "[") {
|
|
1859
1865
|
const close = within(nextCh === "(" ? "\\)" : "\\]", i + 2);
|
|
1860
|
-
|
|
1866
|
+
const isMath = close !== -1 && (nextCh === "(" || isEscapedBracketMath(text.slice(i + 2, close), i > 0 ? text[i - 1] : void 0));
|
|
1867
|
+
if (close !== -1 && isMath) {
|
|
1861
1868
|
inlines.push(this.island("math_inline", i, close + 2, true, { delimiter: nextCh === "(" ? "\\(" : "\\[" }));
|
|
1862
1869
|
i = close + 2;
|
|
1863
1870
|
continue;
|
|
@@ -2404,6 +2411,7 @@ exports.fenceNestsInnerFences = fenceNestsInnerFences;
|
|
|
2404
2411
|
exports.fenceOpenerOf = fenceOpenerOf;
|
|
2405
2412
|
exports.fenceParts = fenceParts;
|
|
2406
2413
|
exports.findCodeRanges = findCodeRanges;
|
|
2414
|
+
exports.isEscapedBracketMath = isEscapedBracketMath;
|
|
2407
2415
|
exports.isMathPlaceholder = isMathPlaceholder;
|
|
2408
2416
|
exports.isSingleDollarMath = isSingleDollarMath;
|
|
2409
2417
|
exports.islandEdit = islandEdit;
|