2016-12-29 07:49:51 +09:00
|
|
|
/**
|
|
|
|
|
* Bold
|
|
|
|
|
*/
|
|
|
|
|
|
2018-06-17 19:55:39 +09:00
|
|
|
export type TextElementBold = {
|
2018-11-03 22:38:12 +09:00
|
|
|
type: 'bold';
|
|
|
|
|
content: string;
|
|
|
|
|
bold: string;
|
2018-06-17 19:55:39 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default function(text: string) {
|
2017-02-11 02:32:00 +09:00
|
|
|
const match = text.match(/^\*\*(.+?)\*\*/);
|
|
|
|
|
if (!match) return null;
|
|
|
|
|
const bold = match[0];
|
|
|
|
|
return {
|
|
|
|
|
type: 'bold',
|
|
|
|
|
content: bold,
|
2018-08-15 20:27:49 +09:00
|
|
|
bold: match[1]
|
2018-06-17 19:55:39 +09:00
|
|
|
} as TextElementBold;
|
|
|
|
|
}
|