fix: fix empty post bodies — stop double-compiling MDX

This commit is contained in:
2026-06-01 21:20:44 -05:00
parent 7685a81f76
commit 6dc42c1ba8
2 changed files with 47 additions and 33 deletions

View File

@@ -1,5 +1,10 @@
import { notFound } from 'next/navigation'
import { MDXRemote } from 'next-mdx-remote/rsc'
import { useMDXComponents } from '@/mdx-components'
import remarkMath from 'remark-math'
import remarkGfm from 'remark-gfm'
import rehypePrettyCode from 'rehype-pretty-code'
import rehypeKatex from 'rehype-katex'
import { getPosts, getPost, getReadingTime } from '@/lib/posts'
import { TableOfContents } from '@/components/blog/TableOfContents'
import { ScrollToTop } from '@/components/ui/ScrollToTop'
@@ -43,7 +48,19 @@ export default async function PostPage({ params }: { params: Promise<{ slug: str
</p>
</header>
<div className="prose prose-lg max-w-none">
<MDXRemote source={post.source} />
<MDXRemote
source={post.source}
components={useMDXComponents({})}
options={{
mdxOptions: {
remarkPlugins: [remarkMath, remarkGfm],
rehypePlugins: [
[rehypePrettyCode, { theme: 'github-dark' }],
rehypeKatex,
],
},
}}
/>
</div>
</article>
<aside className="hidden lg:block">