Skip to content

Commit ef83b28

Browse files
committed
allow dashes and pluses to appear inside emoji names, fix #4
1 parent 60adf41 commit ef83b28

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function tokenize(text, opts = {}) {
4040
return false;
4141
};
4242
const emoji = (type, emojiNames) => {
43-
const match = /^:(\w+):/.exec(chunk);
43+
const match = /^:([A-Za-z0-9_+-]+):/.exec(chunk);
4444
if (match) {
4545
// if a whitelist of emoji names is given, only accept emoji from that
4646
// list.

test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ describe('utils/parseChatMarkup', () => {
8989
'and ',
9090
{ type: 'emoji', name: 'emoji_with_underscores' }
9191
]);
92+
93+
expect(parseChatMarkup('and :emoji-with-dashes+pluses:', bareOptions)).to.eql([
94+
'and ',
95+
{ type: 'emoji', name: 'emoji-with-dashes+pluses' }
96+
]);
9297
});
9398

9499
it('parses :emoji: that could also be italics', () => {

0 commit comments

Comments
 (0)