@ai-matrx/content-ir 0.19.4 → 0.19.6
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 +11 -0
- package/dist/index.cjs +28 -3
- 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 +27 -4
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +28 -3
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +10 -1
- package/dist/source.d.ts +10 -1
- package/dist/source.js +27 -4
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.cjs
CHANGED
|
@@ -269,6 +269,13 @@ function fenceOpenerOf(content) {
|
|
|
269
269
|
}
|
|
270
270
|
return null;
|
|
271
271
|
}
|
|
272
|
+
function opensStrictFence(line) {
|
|
273
|
+
const opener = fenceOpenerOf(line);
|
|
274
|
+
if (!opener) return false;
|
|
275
|
+
if (opener.char === "~") return true;
|
|
276
|
+
const t = line.trimStart();
|
|
277
|
+
return !t.slice(opener.ticks).includes("`");
|
|
278
|
+
}
|
|
272
279
|
var FenceReader = class {
|
|
273
280
|
opener;
|
|
274
281
|
state = { inString: false, escaped: false };
|
|
@@ -555,6 +562,21 @@ function mapCodeRanges(text, fn) {
|
|
|
555
562
|
}
|
|
556
563
|
return out + text.slice(at);
|
|
557
564
|
}
|
|
565
|
+
function findInlineCodeSpans(text) {
|
|
566
|
+
const ranges = [];
|
|
567
|
+
codeSpans(text, 0, text.length, ranges);
|
|
568
|
+
return ranges.sort((a, b) => a.start - b.start);
|
|
569
|
+
}
|
|
570
|
+
function mapInlineCodeSpans(text, fn) {
|
|
571
|
+
let out = "";
|
|
572
|
+
let at = 0;
|
|
573
|
+
for (const r of findInlineCodeSpans(text)) {
|
|
574
|
+
if (r.start < at) continue;
|
|
575
|
+
out += text.slice(at, r.start) + fn(r, text.slice(r.start, r.end));
|
|
576
|
+
at = r.end;
|
|
577
|
+
}
|
|
578
|
+
return out + text.slice(at);
|
|
579
|
+
}
|
|
558
580
|
function codeSpanText(raw) {
|
|
559
581
|
const ticks = backtickRunLength(raw, 0);
|
|
560
582
|
const inner = raw.slice(ticks, raw.length - ticks);
|
|
@@ -2614,7 +2636,8 @@ function rowCells(line) {
|
|
|
2614
2636
|
function unescapeCellPipes(cell) {
|
|
2615
2637
|
return cell.replace(/\\\|/g, "|");
|
|
2616
2638
|
}
|
|
2617
|
-
var BLOCK_START = /^(?:[-+*](?:\s|$)|\d{1,9}[.)](?:\s|$)|>|#{1,6}(?:\s|$)
|
|
2639
|
+
var BLOCK_START = /^(?:[-+*](?:\s|$)|\d{1,9}[.)](?:\s|$)|>|#{1,6}(?:\s|$)|(?:-\s*){3,}$|(?:\*\s*){3,}$|(?:_\s*){3,}$)/;
|
|
2640
|
+
var startsBlock = (trimmed) => BLOCK_START.test(trimmed) || opensStrictFence(trimmed);
|
|
2618
2641
|
var DELIMITER_CELL = /^:?-+:?$/;
|
|
2619
2642
|
function isGfmDelimiterRow(line) {
|
|
2620
2643
|
const trimmed = line.trim();
|
|
@@ -2628,7 +2651,7 @@ function isPipeLedRow(line) {
|
|
|
2628
2651
|
}
|
|
2629
2652
|
function startsPipelessTable(header, delimiter) {
|
|
2630
2653
|
const head = header.trim();
|
|
2631
|
-
if (!head || head.startsWith("|") ||
|
|
2654
|
+
if (!head || head.startsWith("|") || startsBlock(head)) return false;
|
|
2632
2655
|
if (splitRowSegments(head).length < 2) return false;
|
|
2633
2656
|
if (delimiter === void 0 || !isGfmDelimiterRow(delimiter)) return false;
|
|
2634
2657
|
return rowCells(head).length === rowCells(delimiter.trim()).length;
|
|
@@ -2636,7 +2659,7 @@ function startsPipelessTable(header, delimiter) {
|
|
|
2636
2659
|
function continuesTable(line) {
|
|
2637
2660
|
const trimmed = line.trim();
|
|
2638
2661
|
if (!trimmed) return false;
|
|
2639
|
-
return trimmed.startsWith("|") || !
|
|
2662
|
+
return trimmed.startsWith("|") || !startsBlock(trimmed);
|
|
2640
2663
|
}
|
|
2641
2664
|
function opensTable(lines, index) {
|
|
2642
2665
|
const line = lines[index] ?? "";
|
|
@@ -2677,6 +2700,7 @@ exports.fenceNestsInnerFences = fenceNestsInnerFences;
|
|
|
2677
2700
|
exports.fenceOpenerOf = fenceOpenerOf;
|
|
2678
2701
|
exports.fenceParts = fenceParts;
|
|
2679
2702
|
exports.findCodeRanges = findCodeRanges;
|
|
2703
|
+
exports.findInlineCodeSpans = findInlineCodeSpans;
|
|
2680
2704
|
exports.findTableEnd = findTableEnd;
|
|
2681
2705
|
exports.findTableStart = findTableStart;
|
|
2682
2706
|
exports.isEscapedBracketMath = isEscapedBracketMath;
|
|
@@ -2690,6 +2714,7 @@ exports.listIslands = listIslands;
|
|
|
2690
2714
|
exports.looksLikeDisplayMath = looksLikeDisplayMath;
|
|
2691
2715
|
exports.looksLikeOpenInlineMath = looksLikeOpenInlineMath;
|
|
2692
2716
|
exports.mapCodeRanges = mapCodeRanges;
|
|
2717
|
+
exports.mapInlineCodeSpans = mapInlineCodeSpans;
|
|
2693
2718
|
exports.mapPosition = mapPosition;
|
|
2694
2719
|
exports.mapRange = mapRange;
|
|
2695
2720
|
exports.opensTable = opensTable;
|