From 5c78a8a491de48ce7465648a7bc279e62942a753 Mon Sep 17 00:00:00 2001 From: dylan Date: Sun, 28 Dec 2025 21:18:27 +0000 Subject: [PATCH] updated regex for img and video tag removal to fix broken cards (fingers crossed!) --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 09fcb0f..9c2fb02 100644 --- a/index.js +++ b/index.js @@ -133,9 +133,9 @@ export default async function now() { `$1${latest.image}$2`, ) } else { - // remove img tags if no image available (handle multi-line tags) + // remove img tags if no image available (handle multi-line tags and any attribute order) newNow = newNow.replace( - new RegExp(`]*src=["']${imageId}["'][^>]*>`, 'gis'), + new RegExp(`]*\\bsrc=["']${imageId}["'][^>]*>`, 'gis'), '', ) // remove markdown image @@ -154,7 +154,7 @@ export default async function now() { } else { // remove video tags if no video available newNow = newNow.replace( - new RegExp(`]*src=["']${videoId}["'][^>]*>[\\s\\S]*?`, 'gi'), + new RegExp(`]*\\bsrc=["']${videoId}["'][^>]*>[\\s\\S]*?`, 'gis'), '', ) }