add test for anchor tags
This commit is contained in:
@@ -126,10 +126,10 @@ 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 = ["<", ">"]
|
||||
if (href === content) return brackets[0] + href + brackets[1]
|
||||
if (href.startsWith("https://matrix.to/#/@") && content[0] !== "@") content = "@" + content
|
||||
return "[" + content + "](" + brackets[0] + href + brackets[1] + ")"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user