Initial commit 🍀
This commit is contained in:
17
src/common/text/elements/bold.js
Normal file
17
src/common/text/elements/bold.js
Normal file
@@ -0,0 +1,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)
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user