@ai-matrx/content-ir 0.18.3 → 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 +22 -0
- package/dist/index.cjs +9 -1
- 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 +9 -2
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +9 -1
- 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 +9 -2
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
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
|
+
|
|
3
25
|
## 0.18.3
|
|
4
26
|
|
|
5
27
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/index.cjs
CHANGED
|
@@ -5774,6 +5774,12 @@ function singleDollarMathEnd(text, open, limit = text.length) {
|
|
|
5774
5774
|
const content = text.slice(open + 1, close);
|
|
5775
5775
|
return isSingleDollarMath(content, text[close + 1]) ? close + 1 : -1;
|
|
5776
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
|
+
}
|
|
5777
5783
|
|
|
5778
5784
|
// source/xml-tag.ts
|
|
5779
5785
|
var XML_NAME_START = /[A-Za-z_]/;
|
|
@@ -6830,7 +6836,8 @@ var Tokenizer = class {
|
|
|
6830
6836
|
const nextCh = text[i + 1];
|
|
6831
6837
|
if (nextCh === "(" || nextCh === "[") {
|
|
6832
6838
|
const close = within(nextCh === "(" ? "\\)" : "\\]", i + 2);
|
|
6833
|
-
|
|
6839
|
+
const isMath = close !== -1 && (nextCh === "(" || isEscapedBracketMath(text.slice(i + 2, close), i > 0 ? text[i - 1] : void 0));
|
|
6840
|
+
if (close !== -1 && isMath) {
|
|
6834
6841
|
inlines.push(this.island("math_inline", i, close + 2, true, { delimiter: nextCh === "(" ? "\\(" : "\\[" }));
|
|
6835
6842
|
i = close + 2;
|
|
6836
6843
|
continue;
|
|
@@ -7440,6 +7447,7 @@ exports.isCanonicalBlockIR = isCanonicalBlockIR;
|
|
|
7440
7447
|
exports.isDirectiveClass = isDirectiveClass;
|
|
7441
7448
|
exports.isDuplicateBlockSlug = isDuplicateBlockSlug;
|
|
7442
7449
|
exports.isEmptyResidue = isEmptyResidue;
|
|
7450
|
+
exports.isEscapedBracketMath = isEscapedBracketMath;
|
|
7443
7451
|
exports.isIrEnvelopeCache = isIrEnvelopeCache;
|
|
7444
7452
|
exports.isJsonAnyField = isJsonAnyField;
|
|
7445
7453
|
exports.isKindDirective = isKindDirective;
|