diff --git a/src/internal/parser.ts b/src/internal/parser.ts index 20e0072..d011f31 100644 --- a/src/internal/parser.ts +++ b/src/internal/parser.ts @@ -420,7 +420,10 @@ export const language = P.createLanguage({ unicodeEmoji: r => { const emoji = RegExp(twemojiRegex.source); - return P.regexp(emoji).map(content => M.UNI_EMOJI(content)); + return P.regexp(emoji).map(content => { + // 異体字セレクタ(U+FE0F)の場合は文字として返す + return content === '\uFE0F' ? M.TEXT(content) : M.UNI_EMOJI(content); + }); }, plainTag: r => { diff --git a/test/parser.ts b/test/parser.ts index 50ae700..88cfcc2 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -49,6 +49,12 @@ describe('SimpleParser', () => { const output = [TEXT('あ'), EMOJI_CODE('bar'), TEXT('い')]; assert.deepStrictEqual(mfm.parseSimple(input), output); }); + + test('Ignore Variation Selector preceded by Unicode Emoji', () => { + const input = '\uFE0F'; + const output = [TEXT('')]; + assert.deepStrictEqual(mfm.parseSimple(input), output); + }) }); test('disallow other syntaxes', () => {