From 7a9e1168fe9237f1c156d691dba5fbfc1b49dcc7 Mon Sep 17 00:00:00 2001 From: Wonder Collective <> Date: Wed, 14 Feb 2024 07:25:14 +0100 Subject: [PATCH] fix anchor tags where href and content are the same --- m2d/converters/event-to-message.js | 1 + 1 file changed, 1 insertion(+) diff --git a/m2d/converters/event-to-message.js b/m2d/converters/event-to-message.js index 6ddbd261..9cd79bba 100644 --- a/m2d/converters/event-to-message.js +++ b/m2d/converters/event-to-message.js @@ -126,6 +126,7 @@ turndownService.addRule("inlineLink", { if (node.getAttribute("data-message-id")) return `https://discord.com/channels/${node.getAttribute("data-guild-id")}/${node.getAttribute("data-channel-id")}/${node.getAttribute("data-message-id")}` if (node.getAttribute("data-channel-id")) return `<#${node.getAttribute("data-channel-id")}>` const href = node.getAttribute("href") + if (href === content) return href let brackets = ["", ""] content = content.replace(/ @.*/, "") if (href.startsWith("https://matrix.to")) brackets = ["<", ">"]