@ai-matrx/content-ir 0.18.2 → 0.18.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 +27 -8
- 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 -9
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +27 -8
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +14 -1
- package/dist/source.d.ts +14 -1
- package/dist/source.js +27 -9
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.18.4
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/content-ir-core/v0.18.3..npm/content-ir-core/v0.18.4 -- apps/shared/content-ir-core`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## Unreleased
|
|
10
|
+
|
|
11
|
+
**`/source`: THE escaped-bracket rule** (verify-RC-B4 R3-2). `\[ … \]` is a
|
|
12
|
+
display-math island only when its content is real TeX — a command, `^ { } =
|
|
13
|
+
< > +`, or a subscript on a letter — and the `\[` is not an index on an
|
|
14
|
+
identifier. Everything else is CommonMark's escaped brackets and stays text:
|
|
15
|
+
citations `\[1\]`, dates `\[2026-09-25\]`, task boxes `- \[x\]`, `arr\[i\]`,
|
|
16
|
+
editorial `\[was\]`, placeholders `\[site name\]`. New export
|
|
17
|
+
`isEscapedBracketMath(content, before)`; the tokenizer asks it. Shared vectors:
|
|
18
|
+
`__tests__/fixtures/escaped-bracket-vectors.json` (7 of 11 red before).
|
|
19
|
+
No Python reader draws `\[ \]` math today (matrx-ai has no bracket-math
|
|
20
|
+
detector), so the vectors are the contract for any future twin.
|
|
21
|
+
- Consumer action: the renderer's math normalizer and the editor ask
|
|
22
|
+
`isEscapedBracketMath` instead of their own bracket rules (matrx-frontend
|
|
23
|
+
`components/markdown-core/math-normalizer.ts`).
|
|
24
|
+
|
|
25
|
+
## 0.18.3
|
|
26
|
+
|
|
27
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
28
|
+
`git diff npm/content-ir-core/v0.18.2..npm/content-ir-core/v0.18.3 -- apps/shared/content-ir-core`).
|
|
29
|
+
No source changes intended and no consumer action required.
|
|
30
|
+
|
|
3
31
|
## 0.18.2 — 2026-09-25
|
|
4
32
|
|
|
5
33
|
**Carries: RC-B10 only.** Three helpers on THE one code-range rule, so every
|
package/dist/index.cjs
CHANGED
|
@@ -5488,16 +5488,27 @@ var BacktickRuns = class {
|
|
|
5488
5488
|
}
|
|
5489
5489
|
};
|
|
5490
5490
|
function codeSpans(text, from, to, out) {
|
|
5491
|
-
|
|
5492
|
-
for (let
|
|
5493
|
-
const
|
|
5494
|
-
|
|
5491
|
+
let runs = null;
|
|
5492
|
+
for (let i = from; i < to; ) {
|
|
5493
|
+
const ch = text.charCodeAt(i);
|
|
5494
|
+
if (ch === 92) {
|
|
5495
|
+
i += 2;
|
|
5496
|
+
continue;
|
|
5497
|
+
}
|
|
5498
|
+
if (ch !== 96) {
|
|
5499
|
+
i++;
|
|
5500
|
+
continue;
|
|
5501
|
+
}
|
|
5502
|
+
const n = backtickRunLength(text, i);
|
|
5503
|
+
const len = Math.min(n, to - i);
|
|
5504
|
+
runs ??= new BacktickRuns(text, from, to);
|
|
5505
|
+
const close = runs.next(len, i + len);
|
|
5495
5506
|
if (close === -1) {
|
|
5496
|
-
|
|
5507
|
+
i += len;
|
|
5497
5508
|
continue;
|
|
5498
5509
|
}
|
|
5499
|
-
out.push({ start, end: close +
|
|
5500
|
-
|
|
5510
|
+
out.push({ start: i, end: close + len, kind: "span" });
|
|
5511
|
+
i = close + len;
|
|
5501
5512
|
}
|
|
5502
5513
|
}
|
|
5503
5514
|
function findCodeRanges(text) {
|
|
@@ -5763,6 +5774,12 @@ function singleDollarMathEnd(text, open, limit = text.length) {
|
|
|
5763
5774
|
const content = text.slice(open + 1, close);
|
|
5764
5775
|
return isSingleDollarMath(content, text[close + 1]) ? close + 1 : -1;
|
|
5765
5776
|
}
|
|
5777
|
+
var BRACKET_TEX_SIGNAL = /\\[A-Za-z]+|[\^{}=<>+]|_\{|(?:^|[^A-Za-z0-9])[A-Za-z]_[A-Za-z0-9](?![A-Za-z0-9])/;
|
|
5778
|
+
function isEscapedBracketMath(content, before) {
|
|
5779
|
+
if (!content.trim()) return false;
|
|
5780
|
+
if (before !== void 0 && /[A-Za-z0-9_)\]]/.test(before)) return false;
|
|
5781
|
+
return BRACKET_TEX_SIGNAL.test(content);
|
|
5782
|
+
}
|
|
5766
5783
|
|
|
5767
5784
|
// source/xml-tag.ts
|
|
5768
5785
|
var XML_NAME_START = /[A-Za-z_]/;
|
|
@@ -6819,7 +6836,8 @@ var Tokenizer = class {
|
|
|
6819
6836
|
const nextCh = text[i + 1];
|
|
6820
6837
|
if (nextCh === "(" || nextCh === "[") {
|
|
6821
6838
|
const close = within(nextCh === "(" ? "\\)" : "\\]", i + 2);
|
|
6822
|
-
|
|
6839
|
+
const isMath = close !== -1 && (nextCh === "(" || isEscapedBracketMath(text.slice(i + 2, close), i > 0 ? text[i - 1] : void 0));
|
|
6840
|
+
if (close !== -1 && isMath) {
|
|
6823
6841
|
inlines.push(this.island("math_inline", i, close + 2, true, { delimiter: nextCh === "(" ? "\\(" : "\\[" }));
|
|
6824
6842
|
i = close + 2;
|
|
6825
6843
|
continue;
|
|
@@ -7429,6 +7447,7 @@ exports.isCanonicalBlockIR = isCanonicalBlockIR;
|
|
|
7429
7447
|
exports.isDirectiveClass = isDirectiveClass;
|
|
7430
7448
|
exports.isDuplicateBlockSlug = isDuplicateBlockSlug;
|
|
7431
7449
|
exports.isEmptyResidue = isEmptyResidue;
|
|
7450
|
+
exports.isEscapedBracketMath = isEscapedBracketMath;
|
|
7432
7451
|
exports.isIrEnvelopeCache = isIrEnvelopeCache;
|
|
7433
7452
|
exports.isJsonAnyField = isJsonAnyField;
|
|
7434
7453
|
exports.isKindDirective = isKindDirective;
|