1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-27 08:31:20 +02:00

Make Markdown urls open in _blank

This commit is contained in:
Chen-I Lim 2020-10-21 16:06:11 -07:00
parent 3dfeeeba6d
commit 3f35d615c0

View File

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