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

export type TextElementBold = {
	type: 'bold'
	content: string
	bold: string
};

export default function(text: string) {
	const match = text.match(/^\*\*(.+?)\*\*/);
	if (!match) return null;
	const bold = match[0];
	return {
		type: 'bold',
		content: bold,
		bold: bold.substr(2, bold.length - 4)
	} as TextElementBold;
}