Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 02e6dda

Browse files
author
Steven nguyen
authored
[chore] Use marked v4
Copied from icecream17#2 Actually updating to v4.0.10 The only relevant breaking change: https://github.com/markedjs/marked/releases/tag/v4.0.0 is that the default export is removed: `({marked} = require('marked'))` Parens are required to make it not a SyntaxError. Only other change is that the docs: https://marked.js.org/using_advanced recommend using sanitize on the output instead of in the options
1 parent b5629b6 commit 02e6dda

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/helpers.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -515,21 +515,17 @@ let domPurify = null;
515515

516516
export function renderMarkdown(md) {
517517
if (marked === null) {
518-
marked = require('marked');
518+
({marked} = require('marked'));
519519

520520
if (domPurify === null) {
521521
const createDOMPurify = require('dompurify');
522522
domPurify = createDOMPurify();
523523
}
524524

525-
marked.setOptions({
526-
silent: true,
527-
sanitize: true,
528-
sanitizer: html => domPurify.sanitize(html),
529-
});
525+
marked.setOptions({silent: true});
530526
}
531527

532-
return marked(md);
528+
return domPurify.sanitize(marked(md));
533529
}
534530

535531
export const GHOST_USER = {

0 commit comments

Comments
 (0)