@ai-matrx/content-ir 0.19.6 → 0.19.8

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
@@ -234,6 +234,7 @@ function parseFenceOpener(line) {
234
234
  let ticks = 0;
235
235
  while (start + ticks < end && line[start + ticks] === "`") ticks++;
236
236
  if (ticks < 3) return null;
237
+ if (line.slice(start + ticks, end).includes("`")) return null;
237
238
  let infoStart = start + ticks;
238
239
  while (infoStart < end && isOpenerWhitespace(line[infoStart])) infoStart++;
239
240
  let langEnd = infoStart;
@@ -258,9 +259,9 @@ function classifyInnerFenceLine(trimmed, openTicks, nests, nestedDepth) {
258
259
  function fenceOpenerOf(content) {
259
260
  const t = content.trimStart();
260
261
  if (t.startsWith("```")) {
261
- let ticks = 0;
262
- while (ticks < t.length && t[ticks] === "`") ticks++;
263
- return { char: "`", ticks, lang: parseFenceOpener(t)?.lang ?? "" };
262
+ const parsed = parseFenceOpener(t);
263
+ if (!parsed) return null;
264
+ return { char: "`", ticks: parsed.ticks, lang: parsed.lang };
264
265
  }
265
266
  if (content.length - t.length <= 3 && t.startsWith("~~~")) {
266
267
  const open = /^(~{3,})(.*)$/.exec(t);
@@ -270,11 +271,7 @@ function fenceOpenerOf(content) {
270
271
  return null;
271
272
  }
272
273
  function opensStrictFence(line) {
273
- const opener = fenceOpenerOf(line);
274
- if (!opener) return false;
275
- if (opener.char === "~") return true;
276
- const t = line.trimStart();
277
- return !t.slice(opener.ticks).includes("`");
274
+ return fenceOpenerOf(line) !== null;
278
275
  }
279
276
  var FenceReader = class {
280
277
  opener;