From 967dfea182e940233162f796f053fd12f93d9978 Mon Sep 17 00:00:00 2001 From: Spectralitree Date: Sat, 6 Feb 2021 17:03:26 +0100 Subject: [PATCH] markdown links open in new tab --- src/Functions/discord-parser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Functions/discord-parser.js b/src/Functions/discord-parser.js index 45bf1276..09fd2dc0 100644 --- a/src/Functions/discord-parser.js +++ b/src/Functions/discord-parser.js @@ -152,7 +152,11 @@ const rules = { return htmlTag('a', output(node.content, state), { class: 'd-spoiler' }, state); } }, - link: markdown.defaultRules.link + link: Object.assign({ }, markdown.defaultRules.link, { + html: (node, output, state) => { + return htmlTag('a', output(node.content, state), { href: markdown.sanitizeUrl(node.target), rel: "noreferrer", target: "_blank" }, state); + } + }) }; const discordCallbackDefaults = {