@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/index.js
CHANGED
|
@@ -5801,6 +5801,7 @@ var IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
|
5801
5801
|
var MATH_SUFFIX = /^(?:s|es|th|st|nd|rd)$/i;
|
|
5802
5802
|
function isVariableChain(content, after) {
|
|
5803
5803
|
if (/^\{[A-Za-z_][\w.]*\}$/.test(content)) return true;
|
|
5804
|
+
if (/^\(\(.*\)\)$/.test(content) || /^_[.[]/.test(content)) return true;
|
|
5804
5805
|
if (!after) return false;
|
|
5805
5806
|
if (after[0] === "{") return IDENTIFIER.test(content);
|
|
5806
5807
|
const run = /^[A-Za-z0-9_]+/.exec(after)?.[0];
|
|
@@ -6372,6 +6373,16 @@ var Tokenizer = class {
|
|
|
6372
6373
|
holdUndecidedTail() {
|
|
6373
6374
|
const last = this.lineStarts.length - 1;
|
|
6374
6375
|
if (last < 0) return;
|
|
6376
|
+
if (this.provisionalFrom < this.n) {
|
|
6377
|
+
for (let b = 0; b < this.blocks.length; b++) {
|
|
6378
|
+
const block = this.blocks[b];
|
|
6379
|
+
if (block.end <= this.provisionalFrom) continue;
|
|
6380
|
+
if (block.kind === "prose") block.inlines = block.inlines.filter((inline) => inline.end <= this.provisionalFrom);
|
|
6381
|
+
else if (block.island?.fromParagraph && block.start < this.provisionalFrom) {
|
|
6382
|
+
this.blocks[b] = { kind: "prose", start: block.start, end: block.end, island: null, inlines: [] };
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
}
|
|
6375
6386
|
if (this.isOpenTail(last)) {
|
|
6376
6387
|
let b = this.blocks.length - 1;
|
|
6377
6388
|
while (b >= 0 && this.blocks[b].kind === "gap") b--;
|
|
@@ -6669,6 +6680,9 @@ var Tokenizer = class {
|
|
|
6669
6680
|
}
|
|
6670
6681
|
if (this.isOpenTail(k)) return this.heldFootnote(p, open[1]);
|
|
6671
6682
|
if (FOOTNOTE_DEF.test(line.trimStart())) break;
|
|
6683
|
+
if (this.streaming && TREE_GLYPHS.test(line) && this.connectorRunReachesEnd(k)) {
|
|
6684
|
+
return this.heldFootnote(p, open[1]);
|
|
6685
|
+
}
|
|
6672
6686
|
const block = this.detectBlock(this.lineStarts[k], k, false);
|
|
6673
6687
|
if (block && this.mayDissolve(block)) return this.heldFootnote(p, open[1]);
|
|
6674
6688
|
if (block) break;
|
|
@@ -6676,8 +6690,22 @@ var Tokenizer = class {
|
|
|
6676
6690
|
}
|
|
6677
6691
|
const end = this.contentEnds[last];
|
|
6678
6692
|
if (this.paragraphMayGrow(end)) return this.heldFootnote(p, open[1]);
|
|
6693
|
+
if (this.streaming && end > this.provisionalFrom) return this.heldFootnote(p, open[1]);
|
|
6679
6694
|
return this.island("footnote_def", p, end, true, { id: open[1] });
|
|
6680
6695
|
}
|
|
6696
|
+
/** Every line from `k` to the end is a connector line or blank (a tree may still form there). */
|
|
6697
|
+
connectorRunReachesEnd(k) {
|
|
6698
|
+
if (this.lastNonConnectorLine === void 0) {
|
|
6699
|
+
let j = this.lineCount - 1;
|
|
6700
|
+
for (; j >= 0; j--) {
|
|
6701
|
+
this.tick(1);
|
|
6702
|
+
if (!this.lineIsBlank(j) && !TREE_GLYPHS.test(this.lineText(j))) break;
|
|
6703
|
+
}
|
|
6704
|
+
this.lastNonConnectorLine = j;
|
|
6705
|
+
}
|
|
6706
|
+
return k > this.lastNonConnectorLine;
|
|
6707
|
+
}
|
|
6708
|
+
lastNonConnectorLine = void 0;
|
|
6681
6709
|
/** A footnote whose continuation is still arriving: open to the end of the text. */
|
|
6682
6710
|
heldFootnote(p, id) {
|
|
6683
6711
|
return this.island("footnote_def", p, this.n, false, { id });
|
|
@@ -6942,7 +6970,6 @@ var Tokenizer = class {
|
|
|
6942
6970
|
if (isRecognizedJsonHead(this.text.slice(tp, tp + 512))) {
|
|
6943
6971
|
return this.island("json", p, this.n, false, jsonMeta(this.text.slice(tp)));
|
|
6944
6972
|
}
|
|
6945
|
-
this.provisionalFrom = Math.min(this.provisionalFrom, p);
|
|
6946
6973
|
return null;
|
|
6947
6974
|
}
|
|
6948
6975
|
if (net !== 0) return null;
|
|
@@ -7663,8 +7690,7 @@ function startsPipelessTable(header, delimiter) {
|
|
|
7663
7690
|
function continuesTable(line) {
|
|
7664
7691
|
const trimmed = line.trim();
|
|
7665
7692
|
if (!trimmed) return false;
|
|
7666
|
-
|
|
7667
|
-
return splitRowSegments(trimmed).length > 1 && !BLOCK_START.test(trimmed);
|
|
7693
|
+
return trimmed.startsWith("|") || !BLOCK_START.test(trimmed);
|
|
7668
7694
|
}
|
|
7669
7695
|
function opensTable(lines, index) {
|
|
7670
7696
|
const line = lines[index] ?? "";
|