Skip to content

Commit 7e45533

Browse files
committed
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: 2063eb8 - Inspirational source of the original RegEx: https://github.com/hackmdio/codimd/blob/2063eb8bdf9c0537e9fcfadd7f587658c72bd281/public/js/extra.js#L1095 Signed-off-by: Sheogorath <[email protected]>
1 parent 279213e commit 7e45533

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

public/js/extra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ const pdfPlugin = new Plugin(
11471147

11481148
const emojijsPlugin = new Plugin(
11491149
// regexp to match emoji shortcodes :something:
1150-
/:([\d\D]*):/,
1150+
/:([^\s:]+):/,
11511151

11521152
(match, utils) => {
11531153
const emoji = match[1] ? match[1].toLowerCase() : undefined

0 commit comments

Comments
 (0)