mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Named links in rich embed markdown
This commit is contained in:
parent
6578526ef6
commit
64cb595f0d
@ -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, "<a href=\"$2\" target=\"_blank\">$1</a>");
|
||||
}
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user