Skip to content

Commit

Permalink
fix: remove workaround for escaping doctype
Browse files Browse the repository at this point in the history
This was fixed in marked 0.4.0
markedjs/marked#354 (comment)
  • Loading branch information
aminya committed Sep 23, 2020
1 parent b7ff14f commit c8936b8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ function tokenizeEditor(editorElement: HTMLElement, preElement: HTMLPreElement):
* @return {Node} the html template node containing the result
*/
function internalRender(markdownText: string): Node {
// Remove the <!doctype> since otherwise marked will escape it
// https://github.com/chjj/marked/issues/354
let text = markdownText.replace(/^\s*<!doctype(\s+.*)?>\s*/i, '');
let html = DOMPurify.sanitize(marked(text, { breaks: true }));
let html = DOMPurify.sanitize(marked(markdownText, { breaks: true }));
let template = document.createElement('template');
template.innerHTML = html.trim();
return template.content.cloneNode(true);
Expand Down

0 comments on commit c8936b8

Please sign in to comment.