Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-Dabade committed Nov 25, 2024
1 parent ed75ed9 commit 1050e69
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions webapp/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,22 +289,7 @@ class Utils {
// Markdown

static htmlFromMarkdown(text: string): string {
// HACKHACK: Somehow, marked doesn't encode angle brackets
const renderer = new marked.Renderer()
renderer.link = (href, title, contents) => {
return '<a ' +
'target="_blank" ' +
'rel="noreferrer" ' +
`href="${encodeURI(decodeURI(href || ''))}" ` +
`title="${title || ''}" ` +
`onclick="${(window.openInNewBrowser ? ' openInNewBrowser && openInNewBrowser(event.target.href);' : '')}"` +
'>' + contents + '</a>'
}

renderer.table = (header, body) => {
return `<div class="table-responsive"><table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table></div>`
}

const renderer = this.getMarkdownRenderer()
return this.htmlFromMarkdownWithRenderer(text, renderer)
}

Expand Down

0 comments on commit 1050e69

Please sign in to comment.