@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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.21.2
4
+
5
+ ### `/source`: a ```json fence's string state never crosses a line end (never-raw R11 H2)
6
+
7
+ - `FenceReader` (behind `closeFence`, `fenceLineKinds`, `findCodeRanges`, the XML / directive balance walkers) read
8
+ JSON-string state across lines inside a ```json fence. A JSON string never holds a raw newline, so a body line
9
+ that ends inside one (`{\"__kind\":\"note\"}` — escaped quotes, a cut value) swallowed the closing ``` and every
10
+ following list item / quoted line. The state is now read per line; a backtick run inside a string on the same line
11
+ is still text.
12
+
13
+ ### Consumer action
14
+
15
+ - None required. matrx-frontend may drop its splitter workaround (`jsonLineForFenceReader` in
16
+ content-splitter-core.ts) once on 0.21.2.
17
+
3
18
  ## 0.21.1
4
19
 
5
20
  ### `/source`: the tokenizer locks what the renderer draws (fuzz `source-covers-renderer`)
package/dist/index.cjs CHANGED
@@ -5487,9 +5487,9 @@ function fenceOpenerOf(content) {
5487
5487
  function opensStrictFence(line) {
5488
5488
  return fenceOpenerOf(line) !== null;
5489
5489
  }
5490
+ var LINE_START = { inString: false, escaped: false };
5490
5491
  var FenceReader = class {
5491
5492
  opener;
5492
- state = { inString: false, escaped: false };
5493
5493
  depth = 0;
5494
5494
  /** A nested fence was opened at some point. */
5495
5495
  sawNested = false;
@@ -5510,17 +5510,8 @@ var FenceReader = class {
5510
5510
  if (this.tildeCloser) return this.tildeCloser.test(line);
5511
5511
  const trimmedLine = trimFenceLine(line);
5512
5512
  const at = line.indexOf("```");
5513
- if (at === -1) {
5514
- if (this.isJson) this.state = jsonStringState(line, 0, line.length, this.state);
5515
- return false;
5516
- }
5517
- if (this.isJson) {
5518
- const probe = jsonStringState(line, 0, at, this.state);
5519
- if (probe.inString) {
5520
- this.state = jsonStringState(line, at, line.length, probe);
5521
- return false;
5522
- }
5523
- }
5513
+ if (at === -1) return false;
5514
+ if (this.isJson && jsonStringState(line, 0, at, LINE_START).inString) return false;
5524
5515
  if (trimmedLine.startsWith("```")) {
5525
5516
  const kind = classifyInnerFenceLine(trimmedLine, this.opener.ticks, this.nesting, this.depth);
5526
5517
  if (kind === "close-outer") return true;
@@ -5534,7 +5525,6 @@ var FenceReader = class {
5534
5525
  const after = trimFenceLine(line.slice(at + closeTicks));
5535
5526
  if (closeTicks >= this.opener.ticks && after === "" && this.depth === 0) return true;
5536
5527
  }
5537
- if (this.isJson) this.state = jsonStringState(line, 0, line.length, this.state);
5538
5528
  return false;
5539
5529
  }
5540
5530
  };