Preserve line breaks in markdown

This commit is contained in:
Chen-I Lim 2020-11-18 11:01:07 -08:00
parent 998cb36421
commit 4f84ecb741

View file

@ -49,7 +49,7 @@ class Utils {
// HACKHACK: Somehow, marked doesn't encode angle brackets // HACKHACK: Somehow, marked doesn't encode angle brackets
const renderer = new marked.Renderer() const renderer = new marked.Renderer()
renderer.link = (href, title, contents) => `<a target="_blank" href="${href}" title="${title || ''}" onclick="event.stopPropagation();">${contents}</a>` renderer.link = (href, title, contents) => `<a target="_blank" href="${href}" title="${title || ''}" onclick="event.stopPropagation();">${contents}</a>`
const html = marked(text.replace(/</g, '&lt;'), {renderer}) const html = marked(text.replace(/</g, '&lt;'), {renderer, breaks: true})
return html return html
} }