From 7e45533c75a3697c916e52e5f4ddff42a38bd3d5 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Mon, 29 Oct 2018 20:37:33 +0100 Subject: [PATCH] Fix emoji regex The old regex, adapted from the other plugins, was a bit too open for matching. This leads to matching something like: `This is a sentence: [And something with a: in it.]()` which doesn't become a link anymore. Because the match is: ` [And something with a`. This patch provides a fix for the regex to only match non-space string within the `:`'s. References: - Introducing commit: https://github.com/hackmdio/codimd/commit/2063eb8bdf9c0537e9fcfadd7f587658c72bd281 - Inspirational source of the original RegEx: https://github.com/hackmdio/codimd/blob/2063eb8bdf9c0537e9fcfadd7f587658c72bd281/public/js/extra.js#L1095 Signed-off-by: Sheogorath --- public/js/extra.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/extra.js b/public/js/extra.js index ddec31a..4db36ff 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -1147,7 +1147,7 @@ const pdfPlugin = new Plugin( const emojijsPlugin = new Plugin( // regexp to match emoji shortcodes :something: - /:([\d\D]*):/, + /:([^\s:]+):/, (match, utils) => { const emoji = match[1] ? match[1].toLowerCase() : undefined