-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
36 lines (30 loc) · 938 Bytes
/
next.config.ts
File metadata and controls
36 lines (30 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import type { Root } from 'mdast';
import type { NextConfig } from 'next';
import type { Plugin } from 'unified';
import createMDX from '@next/mdx';
import rehypeShiki from '@shikijs/rehype';
import remarkDirective from 'remark-directive';
import remarkGfm from 'remark-gfm';
import { visit } from 'unist-util-visit';
import { REHYPE_SHIKI_OPTIONS } from './src/markdown/shiki';
const remarkCodeGroup: Plugin<void[], Root> = () => (tree) => {
visit(tree, 'containerDirective', (node) => {
if (node.name === 'code-group') {
node.data = {
hName: 'CodeGroup',
hProperties: {}
};
}
});
};
const nextConfig: NextConfig = {
reactCompiler: true,
pageExtensions: ['jsx', 'mdx', 'tsx']
};
const withMDX = createMDX({
options: {
rehypePlugins: [[rehypeShiki, REHYPE_SHIKI_OPTIONS]],
remarkPlugins: [remarkGfm, remarkDirective, remarkCodeGroup]
}
});
export default withMDX(nextConfig);