mirror of https://github.com/Chocobozzz/PeerTube
Fix exception in markdown parser
parent
205e4f56f3
commit
46460547ca
|
@ -9,6 +9,8 @@ markdownIt.enable(TEXT_WITH_HTML_RULES)
|
||||||
markdownIt.use(markdownItEmoji)
|
markdownIt.use(markdownItEmoji)
|
||||||
|
|
||||||
const toSafeHtml = text => {
|
const toSafeHtml = text => {
|
||||||
|
if (!text) return ''
|
||||||
|
|
||||||
// Restore line feed
|
// Restore line feed
|
||||||
const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n')
|
const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n')
|
||||||
|
|
||||||
|
@ -20,6 +22,8 @@ const toSafeHtml = text => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mdToPlainText = text => {
|
const mdToPlainText = text => {
|
||||||
|
if (!text) return ''
|
||||||
|
|
||||||
// Convert possible markdown (emojis, emphasis and lists) to html
|
// Convert possible markdown (emojis, emphasis and lists) to html
|
||||||
const html = markdownIt.render(text)
|
const html = markdownIt.render(text)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue