diff --git a/lib/posts.ts b/lib/posts.ts index 8eca9df..2ea150c 100644 --- a/lib/posts.ts +++ b/lib/posts.ts @@ -4,6 +4,10 @@ import matter from 'gray-matter' import { compileMDX } from 'next-mdx-remote/rsc' import { cache } from 'react' import { useMDXComponents } from '@/mdx-components' +import remarkMath from 'remark-math' +import remarkGfm from 'remark-gfm' +import rehypeKatex from 'rehype-katex' +import rehypePrettyCode from 'rehype-pretty-code' const postsDirectory = path.join(process.cwd(), 'content/posts') @@ -59,7 +63,16 @@ export const getPost = async (slug: string): Promise => { const { content: compiledContent } = await compileMDX({ source: content, components, - options: { parseFrontmatter: true }, + options: { + parseFrontmatter: true, + mdxOptions: { + remarkPlugins: [remarkMath, remarkGfm], + rehypePlugins: [ + [rehypePrettyCode, { theme: 'github-dark' }], + rehypeKatex, + ], + }, + }, }) return {