Fix url replacement.

Closes #1534
This commit is contained in:
Kavin 2022-10-06 09:54:01 +01:00
parent f35dd1c346
commit d6803372f2
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD

View file

@ -183,7 +183,7 @@ const mixin = {
const emailRegex = /([\w-\\.]+@(?:[\w-]+\.)+[\w-]{2,4})/g;
return string
.replace(urlRegex, url => {
if (url.endsWith("</a>")) return url;
if (url.endsWith("</a>") || url.endsWith("<a")) return url;
return `<a href="${url}" target="_blank">${url}</a>`;
})
.replace(emailRegex, email => {