diff --git a/src/utils/enhance-content.js b/src/utils/enhance-content.js index 0584ee26..9ccc110a 100644 --- a/src/utils/enhance-content.js +++ b/src/utils/enhance-content.js @@ -10,15 +10,26 @@ function enhanceContent(content, opts = {}) { const hasLink = / { link.setAttribute('target', '_blank'); }); + + // Remove all classes except `u-url`, `mention`, `hashtag` + const links = Array.from(dom.querySelectorAll('a[class]')); + const whitelistClasses = ['u-url', 'mention', 'hashtag']; + links.forEach((link) => { + link.classList.forEach((c) => { + if (!whitelistClasses.includes(c)) { + link.classList.remove(c); + } + }); + }); } // Add 'has-url-text' to all links that contains a url