diff options
Diffstat (limited to 'server/helpers/markdown.ts')
-rw-r--r-- | server/helpers/markdown.ts | 4 |
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) | |||
9 | markdownIt.use(markdownItEmoji) | 9 | markdownIt.use(markdownItEmoji) |
10 | 10 | ||
11 | const toSafeHtml = text => { | 11 | const 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 | ||
22 | const mdToPlainText = text => { | 24 | const 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 | ||