From 174cc6578243b011c4f55efdb5f5d9fbeeea8454 Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Sun, 4 Aug 2024 11:26:44 -0700 Subject: [PATCH] Improve link matching regex for instant view --- src/render/instantview.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/instantview.ts b/src/render/instantview.ts index a7458cd..0449157 100644 --- a/src/render/instantview.ts +++ b/src/render/instantview.ts @@ -69,7 +69,7 @@ const formatDate = (date: Date, language: string): string => { }; const htmlifyLinks = (input: string): string => { - const urlPattern = /\bhttps?:\/\/[\w.-]+\.\w+[/\w.-]*\w/g; + const urlPattern = /\bhttps?:\/\/(\w+(-\w+)*\.)+[a-z]{2,}(:\d+)?(\/[-\w@:%_+.~#?&/=]*)?/gi; return input.replace(urlPattern, url => { return `${url}`; });