mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
quiz editor and preview
This commit is contained in:
10
nextjs/src/services/htmlMarkdownUtils.ts
Normal file
10
nextjs/src/services/htmlMarkdownUtils.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
"use client";
|
||||
import { marked } from "marked";
|
||||
import * as DOMPurify from "isomorphic-dompurify";
|
||||
|
||||
export function markdownToHTMLSafe(markdownString: string) {
|
||||
const clean = DOMPurify.sanitize(
|
||||
marked.parse(markdownString, { async: false, pedantic: false, gfm: true })
|
||||
);
|
||||
return clean;
|
||||
}
|
||||
Reference in New Issue
Block a user