aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/helpers/markdown.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/helpers/markdown.ts b/server/helpers/markdown.ts
index 7c4a1a8b1..2126bb752 100644
--- a/server/helpers/markdown.ts
+++ b/server/helpers/markdown.ts
@@ -9,6 +9,8 @@ markdownIt.enable(TEXT_WITH_HTML_RULES)
9markdownIt.use(markdownItEmoji) 9markdownIt.use(markdownItEmoji)
10 10
11const toSafeHtml = text => { 11const toSafeHtml = text => {
12 if (!text) return ''
13
12 // Restore line feed 14 // Restore line feed
13 const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n') 15 const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n')
14 16
@@ -20,6 +22,8 @@ const toSafeHtml = text => {
20} 22}
21 23
22const mdToPlainText = text => { 24const mdToPlainText = text => {
25 if (!text) return ''
26
23 // Convert possible markdown (emojis, emphasis and lists) to html 27 // Convert possible markdown (emojis, emphasis and lists) to html
24 const html = markdownIt.render(text) 28 const html = markdownIt.render(text)
25 29