mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 15:48:32 -06:00
19 lines
478 B
TypeScript
19 lines
478 B
TypeScript
"use client";
|
|
import { marked } from "marked";
|
|
// import markedKatex from "marked-katex-extension";
|
|
import * as DOMPurify from "isomorphic-dompurify";
|
|
|
|
export function markdownToHTMLSafe(markdownString: string) {
|
|
// const options = {
|
|
// throwOnError: false,
|
|
// nonStandard: true
|
|
// };
|
|
|
|
// marked.use(markedKatex(options));
|
|
|
|
const clean = DOMPurify.sanitize(
|
|
marked.parse(markdownString, { async: false, pedantic: false, gfm: true })
|
|
);
|
|
return clean;
|
|
}
|