Skip to content

Commit

Permalink
fix: sanitize in our code
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Oct 12, 2020
1 parent 7f8e286 commit 3c0f470
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export async function highlight(code: string, scopeName: string) {

marked.setOptions({
breaks: true,
sanitizer: (html) => DOMPurify.sanitize(html),
})

/**
Expand Down Expand Up @@ -90,6 +89,10 @@ function internalRender(markdownText: string, scopeName: string = "text.plain"):
reject(e)
}
let template = document.createElement("template")

// sanitization
html = DOMPurify.sanitize(html)

template.innerHTML = html.trim()
return resolve(template.content.cloneNode(true))
}
Expand Down

0 comments on commit 3c0f470

Please sign in to comment.