mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 22:14:26 +01:00
feat: support underscore in emoji
This commit is contained in:
@@ -192,6 +192,10 @@ describe('parseTextNote', () => {
|
||||
given: ':bunhd:',
|
||||
expected: [{ type: 'CustomEmoji', content: ':bunhd:', shortcode: 'bunhd' }],
|
||||
},
|
||||
{
|
||||
given: ':sushi_maguro:',
|
||||
expected: [{ type: 'CustomEmoji', content: ':sushi_maguro:', shortcode: 'sushi_maguro' }],
|
||||
},
|
||||
{
|
||||
given: 'Good morning! :pv:!',
|
||||
expected: [
|
||||
@@ -212,7 +216,7 @@ describe('parseTextNote', () => {
|
||||
assert.deepStrictEqual(parsed, expected);
|
||||
});
|
||||
|
||||
it.each([':bunhd_hop:', ':hello', '::: NOSTR :::'])(
|
||||
it.each([':bunhd-hop:', ':+1:', ':-1:', ':hello', '::: NOSTR :::'])(
|
||||
'should parse text note which includes invalid custom emoji ($emoji)',
|
||||
(content) => {
|
||||
const parsed = parseTextNote(content);
|
||||
|
||||
@@ -79,7 +79,7 @@ const tagRefRegex = /(?:#\[(?<idx>\d+)\])/g;
|
||||
const mentionRegex =
|
||||
/(?<mention>(?<nip19>nostr:)?(?<bech32>(?:npub|note|nprofile|nevent)1[ac-hj-np-z02-9]+))/gi;
|
||||
const hashTagRegex = /#(?<hashtag>[\p{Letter}\p{Number}_]+)/gu;
|
||||
const customEmojiRegex = /:(?<emoji>[a-zA-Z0-9]+):/gu;
|
||||
const customEmojiRegex = /:(?<emoji>\w+):/gu;
|
||||
|
||||
const parseTextNote = (textNoteContent: string) => {
|
||||
const matches = [
|
||||
|
||||
Reference in New Issue
Block a user