markdownIt.enable(TEXT_WITH_HTML_RULES)
markdownIt.use(markdownItEmoji)
-const toSafeHtml = text => {
+const toSafeHtml = (text: string) => {
if (!text) return ''
// Restore line feed
return sanitizeHtml(html, sanitizeOptions)
}
-const mdToPlainText = text => {
+const mdToPlainText = (text: string) => {
if (!text) return ''
// Convert possible markdown (emojis, emphasis and lists) to html
return safeHtml.replace(/<[^>]+>/g, '')
.replace(/\n$/, '')
- .replace('\n', ', ')
+ .replace(/\n/g, ', ')
}
// ---------------------------------------------------------------------------