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:
2063eb8bdf
- Inspirational source of the original RegEx:
2063eb8bdf/public/js/extra.js (L1095)

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath 2018-10-29 20:37:33 +01:00
parent 279213eb75
commit 7e45533c75
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD

View file

@ -1147,7 +1147,7 @@ const pdfPlugin = new Plugin(
const emojijsPlugin = new Plugin( const emojijsPlugin = new Plugin(
// regexp to match emoji shortcodes :something: // regexp to match emoji shortcodes :something:
/:([\d\D]*):/, /:([^\s:]+):/,
(match, utils) => { (match, utils) => {
const emoji = match[1] ? match[1].toLowerCase() : undefined const emoji = match[1] ? match[1].toLowerCase() : undefined