2
0
Files
bot/packages/bot-engine/whatsapp/convertRichTextToWhatsAppText.ts
2023-09-20 15:42:34 +02:00

10 lines
296 B
TypeScript

import { TElement } from '@udecode/plate-common'
import { serialize } from 'remark-slate'
export const convertRichTextToWhatsAppText = (richText: TElement[]): string =>
richText
.map((chunk) =>
serialize(chunk)?.replaceAll('**', '*').replaceAll(''', "'")
)
.join('')