diff --git a/wwcompanion-extension/popup.js b/wwcompanion-extension/popup.js
index a4ab4f1..81d93de 100644
--- a/wwcompanion-extension/popup.js
+++ b/wwcompanion-extension/popup.js
@@ -84,6 +84,20 @@ function applyInline(text) {
)}" target="_blank" rel="noreferrer">${label}`;
});
+ output = output.replace(/https?:\/\/[^\s<]+/g, (match) => {
+ let url = match;
+ let suffix = "";
+ while (/[),.;!?]$/.test(url)) {
+ suffix = url.slice(-1) + suffix;
+ url = url.slice(0, -1);
+ }
+ const safeUrl = sanitizeUrl(url);
+ if (!safeUrl) return match;
+ return `${safeUrl}${suffix}`;
+ });
+
output = output.replace(/\*\*([^*]+)\*\*/g, "$1");
output = output.replace(/\*([^*]+)\*/g, "$1");
output = output.replace(/_([^_]+)_/g, "$1");