Make Markdown urls open in _blank
This commit is contained in:
parent
3dfeeeba6d
commit
3f35d615c0
1 changed files with 3 additions and 1 deletions
|
@ -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, '<'))
|
||||
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, '<'), { renderer })
|
||||
return html
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue