Stop propagation on markdown url click

This commit is contained in:
Chen-I Lim 2020-10-21 16:17:10 -07:00
parent 3f35d615c0
commit fe881b001d

View file

@ -48,8 +48,8 @@ class Utils {
static htmlFromMarkdown(text: string): string {
// HACKHACK: Somehow, marked doesn't encode angle brackets
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 })
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})
return html
}