@ai-matrx/content-ir 0.18.2 → 0.18.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/dist/source.cjs CHANGED
@@ -515,16 +515,27 @@ var BacktickRuns = class {
515
515
  }
516
516
  };
517
517
  function codeSpans(text, from, to, out) {
518
- const runs = new BacktickRuns(text, from, to);
519
- for (let r = 0; r < runs.all.length; ) {
520
- const [start, n] = runs.all[r];
521
- const close = runs.next(n, start + n);
518
+ let runs = null;
519
+ for (let i = from; i < to; ) {
520
+ const ch = text.charCodeAt(i);
521
+ if (ch === 92) {
522
+ i += 2;
523
+ continue;
524
+ }
525
+ if (ch !== 96) {
526
+ i++;
527
+ continue;
528
+ }
529
+ const n = backtickRunLength(text, i);
530
+ const len = Math.min(n, to - i);
531
+ runs ??= new BacktickRuns(text, from, to);
532
+ const close = runs.next(len, i + len);
522
533
  if (close === -1) {
523
- r++;
534
+ i += len;
524
535
  continue;
525
536
  }
526
- out.push({ start, end: close + n, kind: "span" });
527
- r = runs.index(close) + 1;
537
+ out.push({ start: i, end: close + len, kind: "span" });
538
+ i = close + len;
528
539
  }
529
540
  }
530
541
  function findCodeRanges(text) {