@ecency/render-helper 2.5.18 → 2.5.19
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/node/index.cjs
CHANGED
|
@@ -2117,7 +2117,8 @@ var BACKTICK_FENCE_RE = /```[\s\S]*?```/g;
|
|
|
2117
2117
|
var TILDE_FENCE_RE = /~~~[\s\S]*?~~~/g;
|
|
2118
2118
|
var INLINE_CODE_RE = /`[^`\n]*`/g;
|
|
2119
2119
|
var INDENTED_CODE_RE = /^(?: {4}|\t).+$/gm;
|
|
2120
|
-
var MD_IMAGE_RE = /!\[[^[\]]*\]\(\s*([^)\s
|
|
2120
|
+
var MD_IMAGE_RE = /!\[[^[\]]*\]\(\s*([^)\s]{1,2048})(?:\s+["'][^"']*["'])?\s*\)/;
|
|
2121
|
+
var MD_IMAGE_PRESENT_RE = /!\[[^[\]]*\]\(\s*[^\s)]/;
|
|
2121
2122
|
var HTML_IMAGE_RE = /<img\b[^>]*?\bsrc\s*=\s*["']([^"']+)["']/i;
|
|
2122
2123
|
var BARE_IMAGE_RE = /(^|\s)(https?:\/\/[^\s<>"'()[\]]+\.(?:tiff?|jpe?g|gif|png|svg|ico|heic|webp|arw)(?:[?#][^\s<>"'()[\]]*)?)/im;
|
|
2123
2124
|
var MD_LINK_RE = /\[([^[\]]*)\]\(\s*([^)\s[]+)(?:\s+["'][^"']*["'])?\s*\)/g;
|
|
@@ -2134,6 +2135,10 @@ function findFirstImageUrl(body, includeBareUrls = false) {
|
|
|
2134
2135
|
return null;
|
|
2135
2136
|
}
|
|
2136
2137
|
}
|
|
2138
|
+
const priorRegion = mdMatch ? cleaned.slice(0, mdMatch.index ?? 0) : cleaned;
|
|
2139
|
+
if (MD_IMAGE_PRESENT_RE.test(priorRegion)) {
|
|
2140
|
+
return null;
|
|
2141
|
+
}
|
|
2137
2142
|
const candidates = [];
|
|
2138
2143
|
if (mdMatch) candidates.push({ url: mdMatch[1], pos: mdMatch.index ?? 0 });
|
|
2139
2144
|
if (htmlMatch && htmlMatch[1] && SAFE_URL_RE.test(htmlMatch[1])) {
|