mirror of
				https://github.com/TitanEmbeds/Titan.git
				synced 2025-11-04 07:47:10 +01:00 
			
		
		
		
	Named links in rich embed markdown
This commit is contained in:
		@@ -1494,7 +1494,7 @@
 | 
				
			|||||||
        return message;
 | 
					        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 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
 | 
					        var links = text.match(geturl_regex); // temporarily remove urls so markdown won't mark inside of the url
 | 
				
			||||||
        if (links) {
 | 
					        if (links) {
 | 
				
			||||||
@@ -1514,6 +1514,9 @@
 | 
				
			|||||||
                text = text.replace("$LINK"+i+"$", links[i]);
 | 
					                text = text.replace("$LINK"+i+"$", links[i]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (embed) {
 | 
				
			||||||
 | 
					            text = text.replace(/\[(.*?)\]\((.*?)\)/g, "<a href=\"$2\" target=\"_blank\">$1</a>");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return text;
 | 
					        return text;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -1621,7 +1624,7 @@
 | 
				
			|||||||
        content = content.replaceAll("\\>", ">");
 | 
					        content = content.replaceAll("\\>", ">");
 | 
				
			||||||
        content = escapeHtml(content);
 | 
					        content = escapeHtml(content);
 | 
				
			||||||
        content = parse_role_mention(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_channels_in_message(content);
 | 
				
			||||||
        content = parse_emoji_in_message(content);
 | 
					        content = parse_emoji_in_message(content);
 | 
				
			||||||
        content = content.replace(/<https:\/\/(.*?)>/g, "https://$1");
 | 
					        content = content.replace(/<https:\/\/(.*?)>/g, "https://$1");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user