@ai-matrx/content-ir 0.19.2 → 0.19.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 +28 -0
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +29 -3
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +8 -2
- package/dist/source.d.ts +8 -2
- package/dist/source.js +29 -3
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.cjs
CHANGED
|
@@ -747,6 +747,7 @@ var IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
|
747
747
|
var MATH_SUFFIX = /^(?:s|es|th|st|nd|rd)$/i;
|
|
748
748
|
function isVariableChain(content, after) {
|
|
749
749
|
if (/^\{[A-Za-z_][\w.]*\}$/.test(content)) return true;
|
|
750
|
+
if (/^\(\(.*\)\)$/.test(content) || /^_[.[]/.test(content)) return true;
|
|
750
751
|
if (!after) return false;
|
|
751
752
|
if (after[0] === "{") return IDENTIFIER.test(content);
|
|
752
753
|
const run = /^[A-Za-z0-9_]+/.exec(after)?.[0];
|
|
@@ -1318,6 +1319,16 @@ var Tokenizer = class {
|
|
|
1318
1319
|
holdUndecidedTail() {
|
|
1319
1320
|
const last = this.lineStarts.length - 1;
|
|
1320
1321
|
if (last < 0) return;
|
|
1322
|
+
if (this.provisionalFrom < this.n) {
|
|
1323
|
+
for (let b = 0; b < this.blocks.length; b++) {
|
|
1324
|
+
const block = this.blocks[b];
|
|
1325
|
+
if (block.end <= this.provisionalFrom) continue;
|
|
1326
|
+
if (block.kind === "prose") block.inlines = block.inlines.filter((inline) => inline.end <= this.provisionalFrom);
|
|
1327
|
+
else if (block.island?.fromParagraph && block.start < this.provisionalFrom) {
|
|
1328
|
+
this.blocks[b] = { kind: "prose", start: block.start, end: block.end, island: null, inlines: [] };
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1321
1332
|
if (this.isOpenTail(last)) {
|
|
1322
1333
|
let b = this.blocks.length - 1;
|
|
1323
1334
|
while (b >= 0 && this.blocks[b].kind === "gap") b--;
|
|
@@ -1615,6 +1626,9 @@ var Tokenizer = class {
|
|
|
1615
1626
|
}
|
|
1616
1627
|
if (this.isOpenTail(k)) return this.heldFootnote(p, open[1]);
|
|
1617
1628
|
if (FOOTNOTE_DEF.test(line.trimStart())) break;
|
|
1629
|
+
if (this.streaming && TREE_GLYPHS.test(line) && this.connectorRunReachesEnd(k)) {
|
|
1630
|
+
return this.heldFootnote(p, open[1]);
|
|
1631
|
+
}
|
|
1618
1632
|
const block = this.detectBlock(this.lineStarts[k], k, false);
|
|
1619
1633
|
if (block && this.mayDissolve(block)) return this.heldFootnote(p, open[1]);
|
|
1620
1634
|
if (block) break;
|
|
@@ -1622,8 +1636,22 @@ var Tokenizer = class {
|
|
|
1622
1636
|
}
|
|
1623
1637
|
const end = this.contentEnds[last];
|
|
1624
1638
|
if (this.paragraphMayGrow(end)) return this.heldFootnote(p, open[1]);
|
|
1639
|
+
if (this.streaming && end > this.provisionalFrom) return this.heldFootnote(p, open[1]);
|
|
1625
1640
|
return this.island("footnote_def", p, end, true, { id: open[1] });
|
|
1626
1641
|
}
|
|
1642
|
+
/** Every line from `k` to the end is a connector line or blank (a tree may still form there). */
|
|
1643
|
+
connectorRunReachesEnd(k) {
|
|
1644
|
+
if (this.lastNonConnectorLine === void 0) {
|
|
1645
|
+
let j = this.lineCount - 1;
|
|
1646
|
+
for (; j >= 0; j--) {
|
|
1647
|
+
this.tick(1);
|
|
1648
|
+
if (!this.lineIsBlank(j) && !TREE_GLYPHS.test(this.lineText(j))) break;
|
|
1649
|
+
}
|
|
1650
|
+
this.lastNonConnectorLine = j;
|
|
1651
|
+
}
|
|
1652
|
+
return k > this.lastNonConnectorLine;
|
|
1653
|
+
}
|
|
1654
|
+
lastNonConnectorLine = void 0;
|
|
1627
1655
|
/** A footnote whose continuation is still arriving: open to the end of the text. */
|
|
1628
1656
|
heldFootnote(p, id) {
|
|
1629
1657
|
return this.island("footnote_def", p, this.n, false, { id });
|
|
@@ -1888,7 +1916,6 @@ var Tokenizer = class {
|
|
|
1888
1916
|
if (isRecognizedJsonHead(this.text.slice(tp, tp + 512))) {
|
|
1889
1917
|
return this.island("json", p, this.n, false, jsonMeta(this.text.slice(tp)));
|
|
1890
1918
|
}
|
|
1891
|
-
this.provisionalFrom = Math.min(this.provisionalFrom, p);
|
|
1892
1919
|
return null;
|
|
1893
1920
|
}
|
|
1894
1921
|
if (net !== 0) return null;
|
|
@@ -2609,8 +2636,7 @@ function startsPipelessTable(header, delimiter) {
|
|
|
2609
2636
|
function continuesTable(line) {
|
|
2610
2637
|
const trimmed = line.trim();
|
|
2611
2638
|
if (!trimmed) return false;
|
|
2612
|
-
|
|
2613
|
-
return splitRowSegments(trimmed).length > 1 && !BLOCK_START.test(trimmed);
|
|
2639
|
+
return trimmed.startsWith("|") || !BLOCK_START.test(trimmed);
|
|
2614
2640
|
}
|
|
2615
2641
|
function opensTable(lines, index) {
|
|
2616
2642
|
const line = lines[index] ?? "";
|