mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-10-07 09:55:46 +00:00
20 lines
318 B
TypeScript
20 lines
318 B
TypeScript
/**
|
|
* 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: match[1]
|
|
} as TextElementBold;
|
|
}
|