diff --git a/src/utils/enhance-content.js b/src/utils/enhance-content.js
index 4783f3c3..417c03c2 100644
--- a/src/utils/enhance-content.js
+++ b/src/utils/enhance-content.js
@@ -57,6 +57,23 @@ function enhanceContent(content, opts = {}) {
block.replaceWith(pre);
});
+ // TWITTER USERNAMES
+ // =================
+ // Convert @username@twitter.com to @username@twitter.com
+ textNodes = extractTextNodes(dom);
+ textNodes.forEach((node) => {
+ let html = node.nodeValue.replace(//g, '>');
+ if (/@[a-zA-Z0-9_]+@twitter\.com/g.test(html)) {
+ html = html.replaceAll(
+ /(@([a-zA-Z0-9_]+)@twitter\.com)/g,
+ '$1',
+ );
+ }
+ fauxDiv.innerHTML = html;
+ const nodes = Array.from(fauxDiv.childNodes);
+ node.replaceWith(...nodes);
+ });
+
if (postEnhanceDOM) {
postEnhanceDOM(dom); // mutate dom
}