8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a126dd4 commit cd93135Copy full SHA for cd93135
next.config.js
@@ -1,23 +1,8 @@
1
const { createLoader } = require('simple-functional-loader')
2
-const rehypePrism = require('@mapbox/rehype-prism')
3
-const visit = require('unist-util-visit')
4
const withBundleAnalyzer = require('@next/bundle-analyzer')({
5
enabled: process.env.ANALYZE === 'true',
6
})
7
-
8
-const tokenClassNames = {
9
- tag: 'text-code-red',
10
- 'attr-name': 'text-code-yellow',
11
- 'attr-value': 'text-code-green',
12
- deleted: 'text-code-red',
13
- inserted: 'text-code-green',
14
- punctuation: 'text-code-white',
15
- keyword: 'text-code-purple',
16
- string: 'text-code-green',
17
- function: 'text-code-blue',
18
- boolean: 'text-code-red',
19
- comment: 'text-gray-400 italic',
20
-}
+const withSyntaxHighlighting = require('./remark/withSyntaxHighlighting')
21
22
module.exports = withBundleAnalyzer({
23
pageExtensions: ['js', 'jsx', 'mdx'],
@@ -43,19 +28,7 @@ module.exports = withBundleAnalyzer({
43
28
{
44
29
loader: '@mdx-js/loader',
45
30
options: {
46
- rehypePlugins: [
47
- rehypePrism,
48
- () => {
49
- return (tree) => {
50
- visit(tree, 'element', (node, index, parent) => {
51
- let [token, type] = node.properties.className || []
52
- if (token === 'token') {
53
- node.properties.className = [tokenClassNames[type]]
54
- }
55
- })
56
57
- },
58
- ],
31
+ remarkPlugins: [withSyntaxHighlighting],
59
32
},
60
33
61
34
]
0 commit comments