Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324import { unified } from "unified";import remarkParse from "remark-parse";import remarkGfm from "remark-gfm";import remarkRehype from "remark-rehype";import rehypeRaw from "rehype-raw";import rehypeReact from "rehype-react";import * as jsxRuntime from "react/jsx-runtime";
export async function renderMarkdown(content: string): Promise<React.ReactNode> { const file = await unified() .use(remarkParse) .use(remarkGfm) .use(remarkRehype, { allowDangerousHtml: true }) .use(rehypeRaw) .use(rehypeReact, { Fragment: jsxRuntime.Fragment, jsx: jsxRuntime.jsx, jsxs: jsxRuntime.jsxs, }) .process(content);
return file.result as React.ReactNode;}