summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2019-09-15 23:33:58 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-09-15 23:33:58 +0900
commit1a8632e80259c74489fd935ae0b7c9c6a320a9d9 (patch)
treeb5f7f7d18eb7a21b2c72fe03c1acb9ef9fce764b
parentFix typo - invalied (#5433) (diff)
downloadmisskey-1a8632e80259c74489fd935ae0b7c9c6a320a9d9.tar.gz
misskey-1a8632e80259c74489fd935ae0b7c9c6a320a9d9.tar.bz2
misskey-1a8632e80259c74489fd935ae0b7c9c6a320a9d9.zip
Fix: Keycap Number Sign が表示できない (#5431)
* Fix: Keycap Number Sign が表示できない * add U+20E3
-rw-r--r--src/mfm/language.ts1
-rw-r--r--test/mfm.ts14
2 files changed, 15 insertions, 0 deletions
diff --git a/src/mfm/language.ts b/src/mfm/language.ts
index 5d5e35fbfd..53c275342b 100644
--- a/src/mfm/language.ts
+++ b/src/mfm/language.ts
@@ -145,6 +145,7 @@ export const mfmLanguage = P.createLanguage({
if (!match) return P.makeFailure(i, 'not a hashtag');
let hashtag = match[1];
hashtag = removeOrphanedBrackets(hashtag);
+ if (hashtag.match(/^(\u20e3|\ufe0f)/)) return P.makeFailure(i, 'not a hashtag');
if (hashtag.match(/^[0-9]+$/)) return P.makeFailure(i, 'not a hashtag');
if (input[i - 1] != null && input[i - 1].match(/[a-z0-9]/i)) return P.makeFailure(i, 'not a hashtag');
if (hashtag.length > 50) return P.makeFailure(i, 'not a hashtag');
diff --git a/test/mfm.ts b/test/mfm.ts
index 03d9f593af..12d9563e58 100644
--- a/test/mfm.ts
+++ b/test/mfm.ts
@@ -639,6 +639,20 @@ describe('MFM', () => {
text('/bar'),
]);
});
+
+ it('ignore Keycap Number Sign (U+0023 + U+20E3)', () => {
+ const tokens = parse('#⃣');
+ assert.deepStrictEqual(tokens, [
+ leaf('emoji', { emoji: '#⃣' })
+ ]);
+ });
+
+ it('ignore Keycap Number Sign (U+0023 + U+FE0F + U+20E3)', () => {
+ const tokens = parse('#️⃣');
+ assert.deepStrictEqual(tokens, [
+ leaf('emoji', { emoji: '#️⃣' })
+ ]);
+ });
});
describe('quote', () => {