summaryrefslogtreecommitdiff
path: root/src/common/text/elements/bold.js
blob: 41a01399dd05811844a99fc1c667d12b1a1fb63e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Bold
 */

const regexp = /\*\*(.+?)\*\*/;

module.exports = {
	test: x => new RegExp('^' + regexp.source).test(x),
	parse: text => {
		const bold = text.match(new RegExp('^' + regexp.source))[0];
		return {
			type: 'bold',
			content: bold,
			bold: bold.substr(2, bold.length - 4)
		};
	}
};