Add the @ sign in the other order

This commit is contained in:
Cadence Ember 2024-01-22 23:36:19 +13:00
parent 4591b5ae03
commit c084aa0156

View file

@ -108,9 +108,9 @@ turndownService.addRule("inlineLink", {
if (node.getAttribute("data-channel-id")) return `<#${node.getAttribute("data-channel-id")}>` if (node.getAttribute("data-channel-id")) return `<#${node.getAttribute("data-channel-id")}>`
const href = node.getAttribute("href") const href = node.getAttribute("href")
let brackets = ["", ""] let brackets = ["", ""]
if (href.startsWith("https://matrix.to")) brackets = ["<", ">"]
if (href.startsWith("https://matrix.to/#/@")) content = "@" + content
content = content.replace(/ @.*/, "") content = content.replace(/ @.*/, "")
if (href.startsWith("https://matrix.to")) brackets = ["<", ">"]
if (href.startsWith("https://matrix.to/#/@") && content[0] !== "@") content = "@" + content
return "[" + content + "](" + brackets[0] + href + brackets[1] + ")" return "[" + content + "](" + brackets[0] + href + brackets[1] + ")"
} }
}) })