Skip to content

Commit 3566a33

Browse files
committed
Enhance blog layout to support raw HTML and GitHub Flavored Markdown in content
1 parent 5b6a960 commit 3566a33

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

apps/web/components/layout/blog-layout.component.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import Head from "next/head";
44
import Image from "next/image";
55
import Link from "next/link";
66
import ReactMarkdown from "react-markdown";
7+
import rehypeRaw from "rehype-raw";
8+
import rehypeSanitize from "rehype-sanitize";
9+
import remarkGfm from "remark-gfm";
710
import { ROUTES } from "../../data/routes.data";
811
import { BlogPost } from "../../pages/blog";
912
import { getImageUrl } from "../../utils/cms";
@@ -196,7 +199,16 @@ export default function BlogLayout({
196199
) : null}
197200

198201
<div className="blog-content-override prose dark:prose-invert prose-indigo mx-auto mt-6">
199-
<ReactMarkdown>{content}</ReactMarkdown>
202+
<ReactMarkdown
203+
rehypePlugins={[
204+
rehypeRaw,
205+
// @ts-ignore
206+
rehypeSanitize({ tagNames: ["div", "iframe"] }),
207+
remarkGfm,
208+
]}
209+
>
210+
{content}
211+
</ReactMarkdown>
200212
</div>
201213
</div>
202214
</div>

0 commit comments

Comments
 (0)