@ai-matrx/content-ir 0.18.1 → 0.18.2
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 +30 -0
- 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 +28 -1
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +30 -0
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +19 -1
- package/dist/source.d.ts +19 -1
- package/dist/source.js +28 -1
- 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.18.2 — 2026-09-25
|
|
4
|
+
|
|
5
|
+
**Carries: RC-B10 only.** Three helpers on THE one code-range rule, so every
|
|
6
|
+
consumer strips or reads code in one line instead of a private regex:
|
|
7
|
+
`mapCodeRanges(text, fn)` (rewrite each fence/span, prose kept byte for
|
|
8
|
+
byte), `codeSpanText(raw)` (CommonMark span text: runs off, one padding space
|
|
9
|
+
each side), `fenceParts(raw)` (opener, body, closed — list-marker line,
|
|
10
|
+
blockquote and the renderer's line-end closer handled).
|
|
11
|
+
- Consumer action: none — refresh to latest.
|
|
12
|
+
|
|
3
13
|
## 0.18.1 — 2026-09-25
|
|
4
14
|
|
|
5
15
|
**Carries: RC-B10 only** (the one code-range rule). No RC-B3 work is pending
|
package/dist/index.cjs
CHANGED
|
@@ -5506,6 +5506,33 @@ function findCodeRanges(text) {
|
|
|
5506
5506
|
for (const [from, to] of s.paragraphs) codeSpans(text, from, to, ranges);
|
|
5507
5507
|
return ranges.sort((a, b) => a.start - b.start);
|
|
5508
5508
|
}
|
|
5509
|
+
function mapCodeRanges(text, fn) {
|
|
5510
|
+
let out = "";
|
|
5511
|
+
let at = 0;
|
|
5512
|
+
for (const r of findCodeRanges(text)) {
|
|
5513
|
+
if (r.start < at) continue;
|
|
5514
|
+
out += text.slice(at, r.start) + fn(r, text.slice(r.start, r.end));
|
|
5515
|
+
at = r.end;
|
|
5516
|
+
}
|
|
5517
|
+
return out + text.slice(at);
|
|
5518
|
+
}
|
|
5519
|
+
function codeSpanText(raw) {
|
|
5520
|
+
const ticks = backtickRunLength(raw, 0);
|
|
5521
|
+
const inner = raw.slice(ticks, raw.length - ticks);
|
|
5522
|
+
return inner.length >= 2 && inner.startsWith(" ") && inner.endsWith(" ") && inner.trim() !== "" ? inner.slice(1, -1) : inner;
|
|
5523
|
+
}
|
|
5524
|
+
function fenceParts(raw) {
|
|
5525
|
+
const lines = raw.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
5526
|
+
const { offset } = quotePrefix(lines[0] ?? "");
|
|
5527
|
+
const opener = fenceOpenerOf((lines[0] ?? "").slice(offset).replace(/^ *(?:[-*+]|\d{1,9}[.)])(?= |\t|$) ?/, ""));
|
|
5528
|
+
if (!opener) return null;
|
|
5529
|
+
const rest = lines.slice(1);
|
|
5530
|
+
const closed = rest.length > 0 && new FenceReader(opener, { nesting: false }).feed(rest[rest.length - 1]);
|
|
5531
|
+
if (!closed) return { opener, body: rest.join("\n"), closed };
|
|
5532
|
+
const last = rest[rest.length - 1];
|
|
5533
|
+
const before = trimFenceLine(last).startsWith("```") ? "" : last.slice(0, last.indexOf("```"));
|
|
5534
|
+
return { opener, body: [...rest.slice(0, -1), ...before.trim() ? [before] : []].join("\n"), closed };
|
|
5535
|
+
}
|
|
5509
5536
|
function fenceLineKinds(text) {
|
|
5510
5537
|
const s = scan(text);
|
|
5511
5538
|
let count = 1;
|
|
@@ -7364,6 +7391,7 @@ exports.capabilityOf = capabilityOf;
|
|
|
7364
7391
|
exports.classifyInboundEnvelopeMetadata = classifyInboundEnvelopeMetadata;
|
|
7365
7392
|
exports.classifyInnerFenceLine = classifyInnerFenceLine;
|
|
7366
7393
|
exports.closeFence = closeFence;
|
|
7394
|
+
exports.codeSpanText = codeSpanText;
|
|
7367
7395
|
exports.collectReferencedKinds = collectReferencedKinds;
|
|
7368
7396
|
exports.collectSchemaReferencedKinds = collectSchemaReferencedKinds;
|
|
7369
7397
|
exports.compareWithExistingKindSchema = compareWithExistingKindSchema;
|
|
@@ -7386,6 +7414,7 @@ exports.fenceDiscriminator = fenceDiscriminator;
|
|
|
7386
7414
|
exports.fenceLineKinds = fenceLineKinds;
|
|
7387
7415
|
exports.fenceNestsInnerFences = fenceNestsInnerFences;
|
|
7388
7416
|
exports.fenceOpenerOf = fenceOpenerOf;
|
|
7417
|
+
exports.fenceParts = fenceParts;
|
|
7389
7418
|
exports.fieldsToDbPayload = fieldsToDbPayload;
|
|
7390
7419
|
exports.findCodeRanges = findCodeRanges;
|
|
7391
7420
|
exports.fingerprintText = fingerprintText;
|
|
@@ -7425,6 +7454,7 @@ exports.looksLikeDirectiveHead = looksLikeDirectiveHead;
|
|
|
7425
7454
|
exports.looksLikeDisplayMath = looksLikeDisplayMath;
|
|
7426
7455
|
exports.looksLikeOpenInlineMath = looksLikeOpenInlineMath;
|
|
7427
7456
|
exports.makePartialKindStalenessGate = makePartialKindStalenessGate;
|
|
7457
|
+
exports.mapCodeRanges = mapCodeRanges;
|
|
7428
7458
|
exports.mapPosition = mapPosition;
|
|
7429
7459
|
exports.mapRange = mapRange;
|
|
7430
7460
|
exports.mergeResidueIntoValue = mergeResidueIntoValue;
|