@ai-matrx/content-ir 0.21.1 → 0.21.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 +15 -0
- package/dist/index.cjs +3 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -13
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +3 -13
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +0 -12
- package/dist/source.d.ts +0 -12
- package/dist/source.js +3 -13
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.d.cts
CHANGED
|
@@ -535,20 +535,8 @@ interface FenceEnd {
|
|
|
535
535
|
line: number;
|
|
536
536
|
closed: boolean;
|
|
537
537
|
}
|
|
538
|
-
/**
|
|
539
|
-
* THE closer rule, read line by line — the one implementation behind
|
|
540
|
-
* `closeFence` and every streaming walker. Feed each following line
|
|
541
|
-
* (container prefixes removed); `feed` returns true on the line that closes
|
|
542
|
-
* the fence. A backtick fence closes by the nested-fence rule or the
|
|
543
|
-
* renderer's line-end closer (`code````), and inside ```json a backtick run in
|
|
544
|
-
* a JSON string is text; a tilde fence closes on `~~~` (≥ its length, ≤ 3
|
|
545
|
-
* spaces). `nesting: false` forces strict CommonMark (the retry `closeFence`
|
|
546
|
-
* makes when a nested fence is left open at the end; a streaming reader
|
|
547
|
-
* cannot look ahead, so it reads with nesting and never retries).
|
|
548
|
-
*/
|
|
549
538
|
declare class FenceReader {
|
|
550
539
|
readonly opener: FenceOpener;
|
|
551
|
-
private state;
|
|
552
540
|
private depth;
|
|
553
541
|
/** A nested fence was opened at some point. */
|
|
554
542
|
sawNested: boolean;
|
package/dist/source.d.ts
CHANGED
|
@@ -535,20 +535,8 @@ interface FenceEnd {
|
|
|
535
535
|
line: number;
|
|
536
536
|
closed: boolean;
|
|
537
537
|
}
|
|
538
|
-
/**
|
|
539
|
-
* THE closer rule, read line by line — the one implementation behind
|
|
540
|
-
* `closeFence` and every streaming walker. Feed each following line
|
|
541
|
-
* (container prefixes removed); `feed` returns true on the line that closes
|
|
542
|
-
* the fence. A backtick fence closes by the nested-fence rule or the
|
|
543
|
-
* renderer's line-end closer (`code````), and inside ```json a backtick run in
|
|
544
|
-
* a JSON string is text; a tilde fence closes on `~~~` (≥ its length, ≤ 3
|
|
545
|
-
* spaces). `nesting: false` forces strict CommonMark (the retry `closeFence`
|
|
546
|
-
* makes when a nested fence is left open at the end; a streaming reader
|
|
547
|
-
* cannot look ahead, so it reads with nesting and never retries).
|
|
548
|
-
*/
|
|
549
538
|
declare class FenceReader {
|
|
550
539
|
readonly opener: FenceOpener;
|
|
551
|
-
private state;
|
|
552
540
|
private depth;
|
|
553
541
|
/** A nested fence was opened at some point. */
|
|
554
542
|
sawNested: boolean;
|
package/dist/source.js
CHANGED
|
@@ -275,9 +275,9 @@ function fenceOpenerOf(content) {
|
|
|
275
275
|
function opensStrictFence(line) {
|
|
276
276
|
return fenceOpenerOf(line) !== null;
|
|
277
277
|
}
|
|
278
|
+
var LINE_START = { inString: false, escaped: false };
|
|
278
279
|
var FenceReader = class {
|
|
279
280
|
opener;
|
|
280
|
-
state = { inString: false, escaped: false };
|
|
281
281
|
depth = 0;
|
|
282
282
|
/** A nested fence was opened at some point. */
|
|
283
283
|
sawNested = false;
|
|
@@ -298,17 +298,8 @@ var FenceReader = class {
|
|
|
298
298
|
if (this.tildeCloser) return this.tildeCloser.test(line);
|
|
299
299
|
const trimmedLine = trimFenceLine(line);
|
|
300
300
|
const at = line.indexOf("```");
|
|
301
|
-
if (at === -1)
|
|
302
|
-
|
|
303
|
-
return false;
|
|
304
|
-
}
|
|
305
|
-
if (this.isJson) {
|
|
306
|
-
const probe = jsonStringState(line, 0, at, this.state);
|
|
307
|
-
if (probe.inString) {
|
|
308
|
-
this.state = jsonStringState(line, at, line.length, probe);
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
301
|
+
if (at === -1) return false;
|
|
302
|
+
if (this.isJson && jsonStringState(line, 0, at, LINE_START).inString) return false;
|
|
312
303
|
if (trimmedLine.startsWith("```")) {
|
|
313
304
|
const kind = classifyInnerFenceLine(trimmedLine, this.opener.ticks, this.nesting, this.depth);
|
|
314
305
|
if (kind === "close-outer") return true;
|
|
@@ -322,7 +313,6 @@ var FenceReader = class {
|
|
|
322
313
|
const after = trimFenceLine(line.slice(at + closeTicks));
|
|
323
314
|
if (closeTicks >= this.opener.ticks && after === "" && this.depth === 0) return true;
|
|
324
315
|
}
|
|
325
|
-
if (this.isJson) this.state = jsonStringState(line, 0, line.length, this.state);
|
|
326
316
|
return false;
|
|
327
317
|
}
|
|
328
318
|
};
|