@ai-matrx/content-ir 0.19.5 → 0.19.7
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 +10 -0
- package/dist/index.cjs +28 -6
- 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 -7
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +28 -6
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +13 -2
- package/dist/source.d.ts +13 -2
- package/dist/source.js +27 -7
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.19.7
|
|
4
|
+
### Unreleased
|
|
5
|
+
|
|
6
|
+
- `/source` **THE fence opener follows GFM (CommonMark 4.5):** a backtick run whose info string holds a backtick opens NO fence — "```` code ```` | b" and "``` `x` | b" are code spans. Applied at the one source (`parseFenceOpener` → `fenceOpenerOf`), so the tokenizer's islands, `findCodeRanges`, content cleanup and every splitter move together; `opensStrictFence` is now just `fenceOpenerOf(line) !== null`. Fence-nesting vectors regenerated (+5 openers, +2 documents); the Python twin moved with them.
|
|
7
|
+
|
|
8
|
+
## 0.19.6
|
|
9
|
+
### Unreleased
|
|
10
|
+
|
|
11
|
+
- `/source`: a table row opening with a backtick run whose info string holds a backtick ("```` code ```` | b") continues the table, as GFM reads it — fences in the table rule are judged by the new `opensStrictFence` (CommonMark 4.5), in the code-range owner. New `findInlineCodeSpans` / `mapInlineCodeSpans` for INLINE content (a table cell, a label) where a leading ``` is a code span, never a fence (verify-RC-B4 round 8).
|
|
12
|
+
|
|
3
13
|
## 0.19.5
|
|
4
14
|
|
|
5
15
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/index.cjs
CHANGED
|
@@ -5294,6 +5294,7 @@ function parseFenceOpener(line) {
|
|
|
5294
5294
|
let ticks = 0;
|
|
5295
5295
|
while (start + ticks < end && line[start + ticks] === "`") ticks++;
|
|
5296
5296
|
if (ticks < 3) return null;
|
|
5297
|
+
if (line.slice(start + ticks, end).includes("`")) return null;
|
|
5297
5298
|
let infoStart = start + ticks;
|
|
5298
5299
|
while (infoStart < end && isOpenerWhitespace(line[infoStart])) infoStart++;
|
|
5299
5300
|
let langEnd = infoStart;
|
|
@@ -5318,9 +5319,9 @@ function classifyInnerFenceLine(trimmed, openTicks, nests, nestedDepth) {
|
|
|
5318
5319
|
function fenceOpenerOf(content) {
|
|
5319
5320
|
const t = content.trimStart();
|
|
5320
5321
|
if (t.startsWith("```")) {
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
return { char: "`", ticks, lang:
|
|
5322
|
+
const parsed = parseFenceOpener(t);
|
|
5323
|
+
if (!parsed) return null;
|
|
5324
|
+
return { char: "`", ticks: parsed.ticks, lang: parsed.lang };
|
|
5324
5325
|
}
|
|
5325
5326
|
if (content.length - t.length <= 3 && t.startsWith("~~~")) {
|
|
5326
5327
|
const open = /^(~{3,})(.*)$/.exec(t);
|
|
@@ -5329,6 +5330,9 @@ function fenceOpenerOf(content) {
|
|
|
5329
5330
|
}
|
|
5330
5331
|
return null;
|
|
5331
5332
|
}
|
|
5333
|
+
function opensStrictFence(line) {
|
|
5334
|
+
return fenceOpenerOf(line) !== null;
|
|
5335
|
+
}
|
|
5332
5336
|
var FenceReader = class {
|
|
5333
5337
|
opener;
|
|
5334
5338
|
state = { inString: false, escaped: false };
|
|
@@ -5615,6 +5619,21 @@ function mapCodeRanges(text, fn) {
|
|
|
5615
5619
|
}
|
|
5616
5620
|
return out + text.slice(at);
|
|
5617
5621
|
}
|
|
5622
|
+
function findInlineCodeSpans(text) {
|
|
5623
|
+
const ranges = [];
|
|
5624
|
+
codeSpans(text, 0, text.length, ranges);
|
|
5625
|
+
return ranges.sort((a, b) => a.start - b.start);
|
|
5626
|
+
}
|
|
5627
|
+
function mapInlineCodeSpans(text, fn) {
|
|
5628
|
+
let out = "";
|
|
5629
|
+
let at = 0;
|
|
5630
|
+
for (const r of findInlineCodeSpans(text)) {
|
|
5631
|
+
if (r.start < at) continue;
|
|
5632
|
+
out += text.slice(at, r.start) + fn(r, text.slice(r.start, r.end));
|
|
5633
|
+
at = r.end;
|
|
5634
|
+
}
|
|
5635
|
+
return out + text.slice(at);
|
|
5636
|
+
}
|
|
5618
5637
|
function codeSpanText(raw) {
|
|
5619
5638
|
const ticks = backtickRunLength(raw, 0);
|
|
5620
5639
|
const inner = raw.slice(ticks, raw.length - ticks);
|
|
@@ -7674,7 +7693,8 @@ function rowCells(line) {
|
|
|
7674
7693
|
function unescapeCellPipes(cell) {
|
|
7675
7694
|
return cell.replace(/\\\|/g, "|");
|
|
7676
7695
|
}
|
|
7677
|
-
var BLOCK_START = /^(?:[-+*](?:\s|$)|\d{1,9}[.)](?:\s|$)|>|#{1,6}(?:\s|$)
|
|
7696
|
+
var BLOCK_START = /^(?:[-+*](?:\s|$)|\d{1,9}[.)](?:\s|$)|>|#{1,6}(?:\s|$)|(?:-\s*){3,}$|(?:\*\s*){3,}$|(?:_\s*){3,}$)/;
|
|
7697
|
+
var startsBlock = (trimmed) => BLOCK_START.test(trimmed) || opensStrictFence(trimmed);
|
|
7678
7698
|
var DELIMITER_CELL = /^:?-+:?$/;
|
|
7679
7699
|
function isGfmDelimiterRow(line) {
|
|
7680
7700
|
const trimmed = line.trim();
|
|
@@ -7688,7 +7708,7 @@ function isPipeLedRow(line) {
|
|
|
7688
7708
|
}
|
|
7689
7709
|
function startsPipelessTable(header, delimiter) {
|
|
7690
7710
|
const head = header.trim();
|
|
7691
|
-
if (!head || head.startsWith("|") ||
|
|
7711
|
+
if (!head || head.startsWith("|") || startsBlock(head)) return false;
|
|
7692
7712
|
if (splitRowSegments(head).length < 2) return false;
|
|
7693
7713
|
if (delimiter === void 0 || !isGfmDelimiterRow(delimiter)) return false;
|
|
7694
7714
|
return rowCells(head).length === rowCells(delimiter.trim()).length;
|
|
@@ -7696,7 +7716,7 @@ function startsPipelessTable(header, delimiter) {
|
|
|
7696
7716
|
function continuesTable(line) {
|
|
7697
7717
|
const trimmed = line.trim();
|
|
7698
7718
|
if (!trimmed) return false;
|
|
7699
|
-
return trimmed.startsWith("|") || !
|
|
7719
|
+
return trimmed.startsWith("|") || !startsBlock(trimmed);
|
|
7700
7720
|
}
|
|
7701
7721
|
function opensTable(lines, index) {
|
|
7702
7722
|
const line = lines[index] ?? "";
|
|
@@ -7789,6 +7809,7 @@ exports.fenceOpenerOf = fenceOpenerOf;
|
|
|
7789
7809
|
exports.fenceParts = fenceParts;
|
|
7790
7810
|
exports.fieldsToDbPayload = fieldsToDbPayload;
|
|
7791
7811
|
exports.findCodeRanges = findCodeRanges;
|
|
7812
|
+
exports.findInlineCodeSpans = findInlineCodeSpans;
|
|
7792
7813
|
exports.findTableEnd = findTableEnd;
|
|
7793
7814
|
exports.findTableStart = findTableStart;
|
|
7794
7815
|
exports.fingerprintText = fingerprintText;
|
|
@@ -7832,6 +7853,7 @@ exports.looksLikeDisplayMath = looksLikeDisplayMath;
|
|
|
7832
7853
|
exports.looksLikeOpenInlineMath = looksLikeOpenInlineMath;
|
|
7833
7854
|
exports.makePartialKindStalenessGate = makePartialKindStalenessGate;
|
|
7834
7855
|
exports.mapCodeRanges = mapCodeRanges;
|
|
7856
|
+
exports.mapInlineCodeSpans = mapInlineCodeSpans;
|
|
7835
7857
|
exports.mapPosition = mapPosition;
|
|
7836
7858
|
exports.mapRange = mapRange;
|
|
7837
7859
|
exports.mergeResidueIntoValue = mergeResidueIntoValue;
|