stream-markdown-parser 0.0.58-beta.0 → 0.0.58-beta.1

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/index.js CHANGED
@@ -7773,7 +7773,7 @@ function fixLinkToken(tokens) {
7773
7773
  tokens.splice(i, 5, ...replacerTokens);
7774
7774
  } else tokens.splice(i, 4, ...replacerTokens);
7775
7775
  if (i === 0) i = replacerTokens.length - 1;
7776
- else i -= replacerTokens.length - 1;
7776
+ else i -= replacerTokens.length + 1;
7777
7777
  continue;
7778
7778
  }
7779
7779
  let href = tokens[i + 2]?.content || "";
@@ -7788,7 +7788,7 @@ function fixLinkToken(tokens) {
7788
7788
  tokens.splice(i, 5, ...replacerTokens);
7789
7789
  } else tokens.splice(i, 4, ...replacerTokens);
7790
7790
  }
7791
- i -= replacerTokens.length - 1;
7791
+ i -= replacerTokens.length + 1;
7792
7792
  continue;
7793
7793
  }
7794
7794
  } else if (curToken.type === "link_open" && curToken.markup === "linkify" && tokens[i - 1]?.type === "text" && tokens[i - 1].content?.endsWith("(")) {
@@ -7886,7 +7886,7 @@ function fixLinkToken(tokens) {
7886
7886
  pushEmClose(replacerTokens, type);
7887
7887
  }
7888
7888
  tokens.splice(i - deleteCount, count, ...replacerTokens);
7889
- i -= replacerTokens.length - 1;
7889
+ i -= replacerTokens.length + 1;
7890
7890
  continue;
7891
7891
  } else if (curToken.content?.startsWith("](") && tokens[i - 1].markup?.includes("*") && tokens[i - 4]?.type === "text" && tokens[i - 4].content?.endsWith("[")) {
7892
7892
  const type = tokens[i - 1].markup.length;
@@ -7913,7 +7913,7 @@ function fixLinkToken(tokens) {
7913
7913
  tokens.splice(i - 4, 8, ...replacerTokens);
7914
7914
  } else if (tokens[i + 1]?.type === "link_open") tokens.splice(i - 4, 10, ...replacerTokens);
7915
7915
  else tokens.splice(i - 4, 7, ...replacerTokens);
7916
- i -= replacerTokens.length - 1;
7916
+ i -= replacerTokens.length + 1;
7917
7917
  continue;
7918
7918
  } else if (curToken.content?.startsWith("](") && tokens[i - 1].type === "strong_close" && tokens[i - 4]?.type === "text" && tokens[i - 4]?.content?.includes("**[")) {
7919
7919
  const replacerTokens = [];
@@ -7939,7 +7939,7 @@ function fixLinkToken(tokens) {
7939
7939
  tokens.splice(i - 4, 8, ...replacerTokens);
7940
7940
  } else if (tokens[i + 1]?.type === "link_open") tokens.splice(i - 4, 10, ...replacerTokens);
7941
7941
  else tokens.splice(i - 4, 7, ...replacerTokens);
7942
- i -= replacerTokens.length - 1;
7942
+ i -= replacerTokens.length + 1;
7943
7943
  continue;
7944
7944
  } else if (curToken.type === "strong_close" && tokens[i + 1]?.type === "text" && tokens[i + 1].content?.includes("](") && tokens[i - 1].type === "text" && /\[.*$/.test(tokens[i - 1].content || "")) {
7945
7945
  const replacerTokens = [];
@@ -10386,19 +10386,7 @@ function parseInlineTokens(tokens, raw, pPreToken, options) {
10386
10386
  }
10387
10387
  return false;
10388
10388
  }
10389
- return normalizeSingleLinkResult(raw, result);
10390
- }
10391
- function normalizeSingleLinkResult(raw, nodes) {
10392
- if (!raw) return nodes;
10393
- const trimmed = raw.trim();
10394
- const m = /^\[([\s\S]+?)\]\(([^)]+)\)$/.exec(trimmed);
10395
- if (!m) return nodes;
10396
- const label = m[1];
10397
- const href = m[2];
10398
- const candidates = nodes.filter((n) => n.type === "link");
10399
- const preferred = candidates.find((n) => String(n.href || "") === href && String(n.text || "") === label) || candidates.find((n) => String(n.href || "") === href);
10400
- if (preferred) return [preferred];
10401
- return nodes;
10389
+ return result;
10402
10390
  }
10403
10391
 
10404
10392
  //#endregion