diff --git a/api/templates/post.html b/api/templates/post.html index 17457c4..71ec9d6 100644 --- a/api/templates/post.html +++ b/api/templates/post.html @@ -59,12 +59,16 @@

{{section.subtitle}}

const texts = document.getElementsByClassName('tm-text'); for (const text of texts) { // Regular expression to match web addresses in the text - const webAddressRegex = /(https?:\/\/[^\s]+)/g; + //const webAddressRegex = /(https?:\/\/[^\s]+)/g; + const webAddressRegex = /(https?:\/\/\S+)|\((https?:\/\/\S+)\)/g; // Replace web addresses with clickable links text.innerHTML = text.innerHTML.replace( webAddressRegex, - '$1' + (match, url1, url2) => { + const url = url1 || url2; + return `${url}`; + } ); } }