import { marked } from "marked" ; import { JSDOM } from "jsdom" ; import createDOMPurify from "dompurify" ; import { createMarkdownOptions } from "./Options" ; import { createCoreProcessor } from "./core" ; param options export const createMarkdown = ( options = { } ) => { const window = new JSDOM ( "" ) . window ; const DOMPurify = createDOMPurify ( window ) ; const dompurifyOptions = options . dompurify ? options . dompurify : { } ; return createCoreProcessor ( { markdownToHTML : ( markdown ) => { return marked ( markdown , options . marked ) ; } , sanitizer : ( html ) => { return DOMPurify . sanitize ( html , dompurifyOptions ) as string ; } } ) ; } ;