@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/dist/source.cjs CHANGED
@@ -277,9 +277,9 @@ function fenceOpenerOf(content) {
277
277
  function opensStrictFence(line) {
278
278
  return fenceOpenerOf(line) !== null;
279
279
  }
280
+ var LINE_START = { inString: false, escaped: false };
280
281
  var FenceReader = class {
281
282
  opener;
282
- state = { inString: false, escaped: false };
283
283
  depth = 0;
284
284
  /** A nested fence was opened at some point. */
285
285
  sawNested = false;
@@ -300,17 +300,8 @@ var FenceReader = class {
300
300
  if (this.tildeCloser) return this.tildeCloser.test(line);
301
301
  const trimmedLine = trimFenceLine(line);
302
302
  const at = line.indexOf("```");
303
- if (at === -1) {
304
- if (this.isJson) this.state = jsonStringState(line, 0, line.length, this.state);
305
- return false;
306
- }
307
- if (this.isJson) {
308
- const probe = jsonStringState(line, 0, at, this.state);
309
- if (probe.inString) {
310
- this.state = jsonStringState(line, at, line.length, probe);
311
- return false;
312
- }
313
- }
303
+ if (at === -1) return false;
304
+ if (this.isJson && jsonStringState(line, 0, at, LINE_START).inString) return false;
314
305
  if (trimmedLine.startsWith("```")) {
315
306
  const kind = classifyInnerFenceLine(trimmedLine, this.opener.ticks, this.nesting, this.depth);
316
307
  if (kind === "close-outer") return true;
@@ -324,7 +315,6 @@ var FenceReader = class {
324
315
  const after = trimFenceLine(line.slice(at + closeTicks));
325
316
  if (closeTicks >= this.opener.ticks && after === "" && this.depth === 0) return true;
326
317
  }
327
- if (this.isJson) this.state = jsonStringState(line, 0, line.length, this.state);
328
318
  return false;
329
319
  }
330
320
  };