-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.mjs
60 lines (54 loc) · 1.39 KB
/
next.config.mjs
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import Shiki from '@shikijs/markdown-it'
import anchor from 'markdown-it-anchor'
import TOC from 'markdown-it-table-of-contents'
// @ts-check
import Markdown from 'unplugin-react-markdown/webpack'
import { slugify } from './scripts/slugify.js'
function parseMetaString(_metaString, _code, lang) {
return {
dataLanguage: lang,
}
}
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
experimental: {
reactCompiler: true
},
webpack: (config) => {
config.plugins.push(Markdown({
markdownItOptions: {
breaks: true,
xhtmlOut: true,
},
markdownItSetup: async (md) => {
md.use(anchor, {
slugify,
permalink: anchor.permalink.linkInsideHeader({
symbol: '#',
renderAttrs: () => ({ 'aria-hidden': 'true' }),
}),
})
md.use(TOC, {
includeLevel: [1, 2, 3, 4],
slugify,
containerHeaderHtml: '<div class="table-of-contents-anchor"><span class="icon-[ri--menu-2-fill]"></span></div>',
})
md.use(await Shiki({
themes: {
light: 'vitesse-light',
dark: 'nord',
},
theme: {
colorReplacements: {
'#2e3440ff': '#282a2d',
},
},
parseMetaString,
}))
},
}))
return config
},
}
export default nextConfig