forked from cloudsmith-io/cloudsmith-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
69 lines (63 loc) · 1.56 KB
/
next.config.mjs
File metadata and controls
69 lines (63 loc) · 1.56 KB
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
61
62
63
64
65
66
67
68
69
import createMDX from '@next/mdx';
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['mdx', 'tsx'],
experimental: {
optimizePackageImports: ['@/components', '@/markdown', '@/icons'],
turbo: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
},
images: {
// Do not allow external images
remotePatterns: [],
},
};
/** @type {import('rehype-autolink-headings').Options} */
const rehypeAutolinkHeadings = {
behavior: 'append',
properties: {
tabIndex: 0,
ariaHidden: true,
className: 'anchor',
},
// This is a "hast syntax tree" of the svg icon from the icon library called "action/link"
// It uses the symbol id to reference the icon from the icon library with <Icon name="action/link" as="symbol" />
content: {
type: 'element',
tagName: 'svg',
properties: {
className: 'anchorIcon',
fill: 'none',
height: 16,
width: 16,
viewBox: '0 0 16 16',
},
children: [{
type: 'element',
tagName: 'use',
properties: { href: '#action/link' }
}]
},
};
const withMDX = createMDX({
options: {
remarkPlugins: [
['remark-gfm'],
['remark-frontmatter'],
['remark-mdx-frontmatter', { name: 'frontmatter' }],
],
rehypePlugins: [
// This removes all imports and images from the markdown document
//['rehype-sanitize'],
['rehype-slug'],
['rehype-autolink-headings', rehypeAutolinkHeadings],
],
},
});
export default withMDX(nextConfig);