summaryrefslogtreecommitdiff
path: root/src/text/parse/elements/title.ts
blob: 9f4708f5d68ccaa472f8799d66f5e275234b9a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * Title
 */

module.exports = text => {
	const match = text.match(/^【(.+?)】\n/);
	if (!match) return null;
	const title = match[0];
	return {
		type: 'title',
		content: title,
		title: title.substr(1, title.length - 3)
	};
};