wip: added html handler in markdown

This commit is contained in:
2024-05-13 18:24:06 +10:00
parent fe41df4244
commit 7252456dd4
3 changed files with 17 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import { unified } from 'unified';
import remarkGfm from 'remark-gfm';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import remarkRehype, { Options as RemarkRehypeOptions } from 'remark-rehype';
import rehypeSanitize from 'rehype-sanitize';
import rehypeHighlight, { Options as RehypeHighlightOptions } from 'rehype-highlight';
import rehypeReact, { Options as RehypeReactOptions } from 'rehype-react';
@@ -9,13 +9,15 @@ import { all } from 'lowlight';
import { Fragment, jsx, jsxs } from 'react/jsx-runtime';
import { MarkPostString } from '@/components/dummyPost';
import { raleway, roboto, nunito } from "@/app/fonts";
import rehypeRaw from "rehype-raw";
export default async function Mark() {
let content = await MarkPostString();
let result = await unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkRehype)
.use(remarkRehype, { allowDangerousHtml: true } as RemarkRehypeOptions)
.use(rehypeRaw)
.use(rehypeSanitize)
.use(rehypeHighlight, {
languages: all,