File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 11import { MDXRemote } from "next-mdx-remote/rsc" ;
22import { notFound } from "next/navigation" ;
3+ import rehypePrettyCode from "rehype-pretty-code" ;
34import { getPostBySlug } from "../utils/blogUtils" ;
45import BlogPostContent from "../components/BlogPostContent" ;
56import Playground from "../components/Playground" ; // Import the Playground component
@@ -38,6 +39,11 @@ export async function generateMetadata({ params }: PostPageProps) {
3839 } ;
3940}
4041
42+ const prettyCodeOptions = {
43+ theme : "github-dark" ,
44+ keepBackground : false ,
45+ } ;
46+
4147export default function PostPage ( { params } : PostPageProps ) {
4248 const post = getPostBySlug ( params . slug ) ;
4349
@@ -46,7 +52,15 @@ export default function PostPage({ params }: PostPageProps) {
4652 }
4753
4854 const content = (
49- < MDXRemote source = { post . content } components = { { Playground } } />
55+ < MDXRemote
56+ source = { post . content }
57+ components = { { Playground } }
58+ options = { {
59+ mdxOptions : {
60+ rehypePlugins : [ [ rehypePrettyCode , prettyCodeOptions ] ] ,
61+ } ,
62+ } }
63+ />
5064 ) ;
5165
5266 return < BlogPostContent post = { post } content = { content } /> ;
You can’t perform that action at this time.
0 commit comments