Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@

## 形式
```
MFM 書き方 Search
MFM 書き方 検索
MFM 書き方 [Search]
MFM 書き方 [検索]
```
Expand Down
5 changes: 1 addition & 4 deletions src/internal/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,7 @@ export const language = P.createLanguage<TypeTable>({
},

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,
Expand Down
20 changes: 3 additions & 17 deletions test/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
];
Expand All @@ -198,27 +198,13 @@ 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 = [
SEARCH('MFM 書き方 123', input)
];
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 = [
Expand All @@ -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);
Expand Down
Loading