@ecency/render-helper 2.5.18 → 2.5.20
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/browser/index.js
CHANGED
|
@@ -2088,7 +2088,8 @@ var BACKTICK_FENCE_RE = /```[\s\S]*?```/g;
|
|
|
2088
2088
|
var TILDE_FENCE_RE = /~~~[\s\S]*?~~~/g;
|
|
2089
2089
|
var INLINE_CODE_RE = /`[^`\n]*`/g;
|
|
2090
2090
|
var INDENTED_CODE_RE = /^(?: {4}|\t).+$/gm;
|
|
2091
|
-
var MD_IMAGE_RE = /!\[[^[\]]*\]\(\s*([^)\s
|
|
2091
|
+
var MD_IMAGE_RE = /!\[[^[\]]*\]\(\s*([^)\s]{1,2048})(?:\s+["'][^"']*["'])?\s*\)/;
|
|
2092
|
+
var MD_IMAGE_PRESENT_RE = /!\[[^[\]]*\]\(\s*[^\s)]/;
|
|
2092
2093
|
var HTML_IMAGE_RE = /<img\b[^>]*?\bsrc\s*=\s*["']([^"']+)["']/i;
|
|
2093
2094
|
var BARE_IMAGE_RE = /(^|\s)(https?:\/\/[^\s<>"'()[\]]+\.(?:tiff?|jpe?g|gif|png|svg|ico|heic|webp|arw)(?:[?#][^\s<>"'()[\]]*)?)/im;
|
|
2094
2095
|
var MD_LINK_RE = /\[([^[\]]*)\]\(\s*([^)\s[]+)(?:\s+["'][^"']*["'])?\s*\)/g;
|
|
@@ -2105,6 +2106,10 @@ function findFirstImageUrl(body, includeBareUrls = false) {
|
|
|
2105
2106
|
return null;
|
|
2106
2107
|
}
|
|
2107
2108
|
}
|
|
2109
|
+
const priorRegion = mdMatch ? cleaned.slice(0, mdMatch.index ?? 0) : cleaned;
|
|
2110
|
+
if (MD_IMAGE_PRESENT_RE.test(priorRegion)) {
|
|
2111
|
+
return null;
|
|
2112
|
+
}
|
|
2108
2113
|
const candidates = [];
|
|
2109
2114
|
if (mdMatch) candidates.push({ url: mdMatch[1], pos: mdMatch.index ?? 0 });
|
|
2110
2115
|
if (htmlMatch && htmlMatch[1] && SAFE_URL_RE.test(htmlMatch[1])) {
|