From adf7798b0d7b51e53c7a1693a5e9748a472cd3df Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Fri, 21 Jul 2023 12:05:53 +0100 Subject: [PATCH] Fixes #4035: Make hyperlink rule match links that contain emojis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The other hyperlink rules (for links in brackets, etc.) have a lot of redundancy and actually use a simpler version of the link detection regex. I haven’t updated those as making the regular expressions consistent should ideally be a separate issue and pull request. --- config/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/src/config.rs b/config/src/config.rs index ef889f87a..d8fa42744 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -1622,7 +1622,7 @@ pub fn default_hyperlink_rules() -> Vec { hyperlink::Rule::with_highlight(r"<(\w+://\S+)>", "$1", 1).unwrap(), // Then handle URLs not wrapped in brackets // and include terminating ), / or - characters, if any - hyperlink::Rule::new(r"\b\w+://\S+[)/a-zA-Z0-9-]+", "$0").unwrap(), + hyperlink::Rule::new(r"\b\w+://\S+[)/a-zA-Z0-9-]+?(?=[\s]|$)", "$0").unwrap(), // implicit mailto link hyperlink::Rule::new(r"\b\w+@[\w-]+(\.[\w-]+)+\b", "mailto:$0").unwrap(), ]