From a498d8d39a95a09d230251e4422fea777bc3667c Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 31 Oct 2018 22:38:05 +0900 Subject: [PATCH] [MFM] Better hashtag detection --- src/mfm/parse/elements/hashtag.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mfm/parse/elements/hashtag.ts b/src/mfm/parse/elements/hashtag.ts index e4e9df6ce..b5c8ae5ac 100644 --- a/src/mfm/parse/elements/hashtag.ts +++ b/src/mfm/parse/elements/hashtag.ts @@ -9,9 +9,9 @@ export type TextElementHashtag = { }; export default function(text: string, i: number) { - if (!(/^\s#[^\s\.,!\?]+/.test(text) || (i == 0 && /^#[^\s\.,!\?]+/.test(text)))) return null; + if (!(/^\s#[^\s\.,!\?#]+/.test(text) || (i == 0 && /^#[^\s\.,!\?#]+/.test(text)))) return null; const isHead = text.startsWith('#'); - const hashtag = text.match(/^\s?#[^\s\.,!\?]+/)[0]; + const hashtag = text.match(/^\s?#[^\s\.,!\?#]+/)[0]; const res: any[] = !isHead ? [{ type: 'text', content: text[0]