diff --git a/docs/syntax.md b/docs/syntax.md index 29ae576..12b0586 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -58,8 +58,6 @@ ## 形式 ``` -MFM 書き方 Search -MFM 書き方 検索 MFM 書き方 [Search] MFM 書き方 [検索] ``` diff --git a/src/internal/parser.ts b/src/internal/parser.ts index 2eaf89c..452ea85 100644 --- a/src/internal/parser.ts +++ b/src/internal/parser.ts @@ -770,10 +770,7 @@ export const language = P.createLanguage({ }, search: () => { - const button = P.alt([ - P.regexp(/\[(検索|search)\]/i), - P.regexp(/(検索|search)/i), - ]); + const button = P.regexp(/\[(search|検索)\]/i); return P.seq( newLine.option(), P.lineBegin, diff --git a/test/parser.ts b/test/parser.ts index 0f7575a..35977d1 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -185,7 +185,7 @@ hoge`; describe('search', () => { describe('検索構文を使用できる', () => { test('Search', () => { - const input = 'MFM 書き方 123 Search'; + const input = 'MFM 書き方 123 [Search]'; const output = [ SEARCH('MFM 書き方 123', input) ]; @@ -198,13 +198,6 @@ hoge`; ]; assert.deepStrictEqual(mfm.parse(input), output); }); - test('search', () => { - const input = 'MFM 書き方 123 search'; - const output = [ - SEARCH('MFM 書き方 123', input) - ]; - assert.deepStrictEqual(mfm.parse(input), output); - }); test('[search]', () => { const input = 'MFM 書き方 123 [search]'; const output = [ @@ -212,13 +205,6 @@ hoge`; ]; assert.deepStrictEqual(mfm.parse(input), output); }); - test('検索', () => { - const input = 'MFM 書き方 123 検索'; - const output = [ - SEARCH('MFM 書き方 123', input) - ]; - assert.deepStrictEqual(mfm.parse(input), output); - }); test('[検索]', () => { const input = 'MFM 書き方 123 [検索]'; const output = [ @@ -228,10 +214,10 @@ hoge`; }); }); test('ブロックの前後にあるテキストが正しく解釈される', () => { - const input = 'abc\nhoge piyo bebeyo 検索\n123'; + const input = 'abc\nhoge piyo bebeyo [検索]\n123'; const output = [ TEXT('abc'), - SEARCH('hoge piyo bebeyo', 'hoge piyo bebeyo 検索'), + SEARCH('hoge piyo bebeyo', 'hoge piyo bebeyo [検索]'), TEXT('123') ]; assert.deepStrictEqual(mfm.parse(input), output);