@ai-matrx/content-ir 0.14.1 → 0.14.3
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 +64 -2
- 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 +64 -3
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +64 -2
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +6 -1
- package/dist/source.d.ts +6 -1
- package/dist/source.js +64 -3
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.d.cts
CHANGED
|
@@ -101,6 +101,11 @@ interface SourceBlock extends SourceSpan {
|
|
|
101
101
|
/** Inline islands of a `prose` block, in document order. Empty otherwise. */
|
|
102
102
|
readonly inlines: readonly SourceIsland[];
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Every callout spelling the renderer resolves (matrx-frontend
|
|
106
|
+
* components/markdown-core/syntax/callout-types.ts ALIASES — keep in step).
|
|
107
|
+
*/
|
|
108
|
+
declare const CALLOUT_NAMES: ReadonlySet<string>;
|
|
104
109
|
/**
|
|
105
110
|
* Cut `text` into blocks whose raw concatenation is exactly `text`.
|
|
106
111
|
* Never throws; unclosed constructs are islands with `complete: false`.
|
|
@@ -407,4 +412,4 @@ declare function looksLikeDisplayMath(inner: string): boolean;
|
|
|
407
412
|
/** Map of `$$` opener offset → closer offset for every pair the renderer shows as math. */
|
|
408
413
|
declare function pairDisplayMath(text: string): Map<number, number>;
|
|
409
414
|
|
|
410
|
-
export { type BlockIslandType, type CodePointIndex, type DisturbedIsland, FENCE_WHITESPACE, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, fenceNestsInnerFences, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, mapPosition, mapRange, pairDisplayMath, readXmlTag, singleDollarMathEnd, spliceSave, splitsSurrogatePair, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine };
|
|
415
|
+
export { type BlockIslandType, CALLOUT_NAMES, type CodePointIndex, type DisturbedIsland, FENCE_WHITESPACE, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, fenceNestsInnerFences, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, mapPosition, mapRange, pairDisplayMath, readXmlTag, singleDollarMathEnd, spliceSave, splitsSurrogatePair, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine };
|
package/dist/source.d.ts
CHANGED
|
@@ -101,6 +101,11 @@ interface SourceBlock extends SourceSpan {
|
|
|
101
101
|
/** Inline islands of a `prose` block, in document order. Empty otherwise. */
|
|
102
102
|
readonly inlines: readonly SourceIsland[];
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Every callout spelling the renderer resolves (matrx-frontend
|
|
106
|
+
* components/markdown-core/syntax/callout-types.ts ALIASES — keep in step).
|
|
107
|
+
*/
|
|
108
|
+
declare const CALLOUT_NAMES: ReadonlySet<string>;
|
|
104
109
|
/**
|
|
105
110
|
* Cut `text` into blocks whose raw concatenation is exactly `text`.
|
|
106
111
|
* Never throws; unclosed constructs are islands with `complete: false`.
|
|
@@ -407,4 +412,4 @@ declare function looksLikeDisplayMath(inner: string): boolean;
|
|
|
407
412
|
/** Map of `$$` opener offset → closer offset for every pair the renderer shows as math. */
|
|
408
413
|
declare function pairDisplayMath(text: string): Map<number, number>;
|
|
409
414
|
|
|
410
|
-
export { type BlockIslandType, type CodePointIndex, type DisturbedIsland, FENCE_WHITESPACE, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, fenceNestsInnerFences, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, mapPosition, mapRange, pairDisplayMath, readXmlTag, singleDollarMathEnd, spliceSave, splitsSurrogatePair, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine };
|
|
415
|
+
export { type BlockIslandType, CALLOUT_NAMES, type CodePointIndex, type DisturbedIsland, FENCE_WHITESPACE, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, fenceNestsInnerFences, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, mapPosition, mapRange, pairDisplayMath, readXmlTag, singleDollarMathEnd, spliceSave, splitsSurrogatePair, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine };
|
package/dist/source.js
CHANGED
|
@@ -512,6 +512,37 @@ var NOT_WHITESPACE = /\S/;
|
|
|
512
512
|
var DIRECTIVE_OPEN = /^(:{2,})([A-Za-z][\w-]*)/;
|
|
513
513
|
var MKDOCS_OPEN = /^(!!!|\?\?\?\+?)[ \t]+([A-Za-z][\w-]*)/;
|
|
514
514
|
var CALLOUT_OPEN = /^>[ \t]*\[!([A-Za-z][\w-]*)\]([+-])?/;
|
|
515
|
+
var CALLOUT_NAMES = /* @__PURE__ */ new Set([
|
|
516
|
+
"note",
|
|
517
|
+
"seealso",
|
|
518
|
+
"example",
|
|
519
|
+
"tip",
|
|
520
|
+
"hint",
|
|
521
|
+
"important",
|
|
522
|
+
"warning",
|
|
523
|
+
"warn",
|
|
524
|
+
"attention",
|
|
525
|
+
"caution",
|
|
526
|
+
"danger",
|
|
527
|
+
"error",
|
|
528
|
+
"failure",
|
|
529
|
+
"fail",
|
|
530
|
+
"missing",
|
|
531
|
+
"bug",
|
|
532
|
+
"info",
|
|
533
|
+
"abstract",
|
|
534
|
+
"summary",
|
|
535
|
+
"tldr",
|
|
536
|
+
"todo",
|
|
537
|
+
"success",
|
|
538
|
+
"check",
|
|
539
|
+
"done",
|
|
540
|
+
"question",
|
|
541
|
+
"help",
|
|
542
|
+
"faq",
|
|
543
|
+
"quote",
|
|
544
|
+
"cite"
|
|
545
|
+
]);
|
|
515
546
|
var FOOTNOTE_DEF = /^\[\^([^\]\s]+)\]:/;
|
|
516
547
|
function countStructuralBraces(source) {
|
|
517
548
|
let opens = 0;
|
|
@@ -905,7 +936,7 @@ var Tokenizer = class {
|
|
|
905
936
|
/** A blockquote whose first line is `> [!TYPE]…` — every following `>` line belongs to it. */
|
|
906
937
|
callout(p, li, t) {
|
|
907
938
|
const open = CALLOUT_OPEN.exec(t);
|
|
908
|
-
if (!open) return null;
|
|
939
|
+
if (!open || !CALLOUT_NAMES.has(open[1].toLowerCase())) return null;
|
|
909
940
|
let last = li;
|
|
910
941
|
for (let k = li + 1; k < this.lineCount; k++) {
|
|
911
942
|
if (!/^ {0,3}>/.test(this.lineText(k))) break;
|
|
@@ -1030,11 +1061,41 @@ var Tokenizer = class {
|
|
|
1030
1061
|
for (let k = li + 1; k < this.lineCount; k++) {
|
|
1031
1062
|
if (this.isOpenTail(k)) continue;
|
|
1032
1063
|
if (close.test(this.lineText(k))) {
|
|
1033
|
-
|
|
1064
|
+
const tildeEnd = this.contentEnds[k];
|
|
1065
|
+
const end = this.rendererOverflow(li + 1, k, tildeEnd);
|
|
1066
|
+
return this.island("fence", p, end, end === this.n ? this.overflowComplete : true, meta);
|
|
1034
1067
|
}
|
|
1035
1068
|
}
|
|
1036
1069
|
return this.island("fence", p, this.n, false, meta);
|
|
1037
1070
|
}
|
|
1071
|
+
/** Completion of the last `rendererOverflow` that ran to the end of the text. */
|
|
1072
|
+
overflowComplete = true;
|
|
1073
|
+
/**
|
|
1074
|
+
* The renderer's splitter does not know ~~~ fences: it reads the lines inside
|
|
1075
|
+
* one as ordinary lines, so a ```` ``` ```` fence (or an XML section, a JSON
|
|
1076
|
+
* block…) that STARTS inside the tilde fence can run past its closer. The
|
|
1077
|
+
* editor must lock at least what the renderer draws (verify-RC-B3 residual
|
|
1078
|
+
* R5), so a tilde island extends over every block the renderer would detect
|
|
1079
|
+
* starting inside it. Returns the island's end.
|
|
1080
|
+
*/
|
|
1081
|
+
rendererOverflow(firstLine, closeLine, tildeEnd) {
|
|
1082
|
+
let end = tildeEnd;
|
|
1083
|
+
this.overflowComplete = true;
|
|
1084
|
+
for (let j = firstLine; j <= closeLine && j < this.lineCount; j++) {
|
|
1085
|
+
const start = this.lineStarts[j];
|
|
1086
|
+
if (this.lineIsBlank(j)) continue;
|
|
1087
|
+
if (this.lineText(j).trimStart().startsWith("~~~")) continue;
|
|
1088
|
+
const inner = this.detectBlockUncached(start, j, false);
|
|
1089
|
+
if (!inner) continue;
|
|
1090
|
+
if (inner.end > end) {
|
|
1091
|
+
end = inner.end;
|
|
1092
|
+
this.overflowComplete = inner.complete;
|
|
1093
|
+
}
|
|
1094
|
+
const lastLine = this.lineOf(Math.max(start, inner.end - 1));
|
|
1095
|
+
if (lastLine > j) j = lastLine;
|
|
1096
|
+
}
|
|
1097
|
+
return end;
|
|
1098
|
+
}
|
|
1038
1099
|
/**
|
|
1039
1100
|
* A line-leading `$$` that OPENS a math pair (source/math-pairs.ts — the
|
|
1040
1101
|
* core's rule). A closer, an unpaired `$$`, or a prose pair is never a block:
|
|
@@ -1854,6 +1915,6 @@ function mapRange(changes, start, end, unit = "utf16") {
|
|
|
1854
1915
|
return { start: newStart, end: newEnd, touched, collapsed: newEnd === newStart && end > start };
|
|
1855
1916
|
}
|
|
1856
1917
|
|
|
1857
|
-
export { FENCE_WHITESPACE, NESTING_FENCE_LANGUAGES, SourceSpliceError, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, fenceNestsInnerFences, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, mapPosition, mapRange, pairDisplayMath, readXmlTag, singleDollarMathEnd, spliceSave, splitsSurrogatePair, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine };
|
|
1918
|
+
export { CALLOUT_NAMES, FENCE_WHITESPACE, NESTING_FENCE_LANGUAGES, SourceSpliceError, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, fenceNestsInnerFences, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, mapPosition, mapRange, pairDisplayMath, readXmlTag, singleDollarMathEnd, spliceSave, splitsSurrogatePair, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine };
|
|
1858
1919
|
//# sourceMappingURL=source.js.map
|
|
1859
1920
|
//# sourceMappingURL=source.js.map
|