import rehypeStringify from "rehype-stringify"; import remarkParse from "remark-parse"; import remarkRehype from "remark-rehype"; import { unified } from "unified"; import { rehypeImageCaptions } from "@/plugins/rehype-image-captions"; export function markdownToHtml(markdown: string): string { const result = unified() .use(remarkParse) .use(remarkRehype, { allowDangerousHtml: true }) .use(rehypeImageCaptions) .use(rehypeStringify, { allowDangerousHtml: true }) .processSync(markdown); return String(result); }