summaryrefslogtreecommitdiff
path: root/src/mfm/parse/elements/search.ts
blob: 9c4b7ffbe5dc1ce771dd69c5dcd8aa5347f27ec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Search
 */

export type TextElementSearch = {
	type: 'search'
	content: string
	query: string
};

export default function(text: string) {
	const match = text.match(/^(.+?) (検索|Search)(\n|$)/i);
	if (!match) return null;
	return {
		type: 'search',
		content: match[0],
		query: match[1]
	};
}