Fix exception in markdown parser

pull/3988/head
Chocobozzz 2021-04-16 07:41:35 +02:00
parent 205e4f56f3
commit 46460547ca
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,8 @@ markdownIt.enable(TEXT_WITH_HTML_RULES)
markdownIt.use(markdownItEmoji)
const toSafeHtml = text => {
if (!text) return ''
// Restore line feed
const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n')
@ -20,6 +22,8 @@ const toSafeHtml = text => {
}
const mdToPlainText = text => {
if (!text) return ''
// Convert possible markdown (emojis, emphasis and lists) to html
const html = markdownIt.render(text)