mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 23:58:31 -06:00
limited latex support
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
"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 })
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user