summaryrefslogtreecommitdiff
path: root/public/js/extra.js
diff options
context:
space:
mode:
authorSheogorath2018-10-29 20:37:33 +0100
committerSheogorath2018-10-29 20:37:47 +0100
commit7e45533c75a3697c916e52e5f4ddff42a38bd3d5 (patch)
tree481155b09df6650cef59d14baeda20f1edf7a8d3 /public/js/extra.js
parent279213eb75ddfe29a81be193e9a42f25979d9d06 (diff)
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 <sheogorath@shivering-isles.com>
Diffstat (limited to '')
-rw-r--r--public/js/extra.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index ddec31a8..4db36ff6 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