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,7 +48,7 @@ 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>`
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
}