+ return sanitizeHtml(html, sanitizeOptions)
+}
+
+const mdToPlainText = text => {
+ if (!text) return ''
+
+ // Convert possible markdown (emojis, emphasis and lists) to html
+ const html = markdownIt.render(text)
+
+ // Convert to safe Html
+ const safeHtml = sanitizeHtml(html, sanitizeOptions)
+
+ return safeHtml.replace(/<[^>]+>/g, '')
+ .replace(/\n$/, '')
+ .replace('\n', ', ')