diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index 03d2aad..3ade493 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -1494,7 +1494,7 @@ return message; } - function parse_message_markdown(text) { + function parse_message_markdown(text, embed=false) { var geturl_regex = /(\(.*?)?\b((?:https?|ftp|file):\/\/[-a-z0-9+&@#\/%?=~_()|!:,.;]*[-a-z0-9+&@#\/%=~_()|])/ig; var links = text.match(geturl_regex); // temporarily remove urls so markdown won't mark inside of the url if (links) { @@ -1514,6 +1514,9 @@ text = text.replace("$LINK"+i+"$", links[i]); } } + if (embed) { + text = text.replace(/\[(.*?)\]\((.*?)\)/g, "$1"); + } return text; } @@ -1621,7 +1624,7 @@ content = content.replaceAll("\\>", ">"); content = escapeHtml(content); content = parse_role_mention(content); - content = parse_message_markdown(content); + content = parse_message_markdown(content, true); content = parse_channels_in_message(content); content = parse_emoji_in_message(content); content = content.replace(/<https:\/\/(.*?)>/g, "https://$1");