2024-01-15 12:33:15 +00:00
|
|
|
import { MDXRemote } from 'next-mdx-remote/rsc'
|
|
|
|
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
|
|
|
|
import rehypeSlug from 'rehype-slug-custom-id'
|
|
|
|
import { components } from './mdx-components'
|
2024-02-12 14:30:55 +00:00
|
|
|
// import rehypeHighlight from 'rehype-highlight'
|
2024-01-15 12:33:15 +00:00
|
|
|
|
|
|
|
interface MdxProps {
|
|
|
|
content: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Mdx({ content }: MdxProps) {
|
|
|
|
return (
|
|
|
|
<MDXRemote
|
|
|
|
source={content}
|
|
|
|
components={components}
|
|
|
|
options={{
|
|
|
|
mdxOptions: {
|
|
|
|
// remarkPlugins: [remarkGfm, {}],
|
|
|
|
rehypePlugins: [
|
2024-02-12 14:30:55 +00:00
|
|
|
// [rehypeHighlight as any, {}],
|
2024-01-15 12:33:15 +00:00
|
|
|
[rehypeAutolinkHeadings, {}],
|
|
|
|
[rehypeSlug, { enableCustomId: true, maintainCase: true, removeAccents: true }],
|
|
|
|
],
|
|
|
|
format: 'mdx',
|
|
|
|
},
|
|
|
|
parseFrontmatter: true,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|