1 |
import rehypePrism from "@mapbox/rehype-prism"; |
2 |
import createMDX from "@next/mdx"; |
3 |
import rehypeAutolinkHeadings from "rehype-autolink-headings"; |
4 |
import rehypeSlug from "rehype-slug"; |
5 |
import remarkFrontmatter from "remark-frontmatter"; |
6 |
import remarkGfm from "remark-gfm"; |
7 |
import remarkMdxFrontmatter from "remark-mdx-frontmatter"; |
8 |
|
9 |
/** @type {import('next').NextConfig} */ |
10 |
const nextConfig = { |
11 |
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"], |
12 |
async rewrites() { |
13 |
return [{ source: "/:path*.(mdx?)", destination: "/:path*" }]; |
14 |
}, |
15 |
}; |
16 |
|
17 |
const withMDX = createMDX({ |
18 |
options: { |
19 |
remarkPlugins: [ |
20 |
remarkGfm, |
21 |
remarkFrontmatter, |
22 |
[remarkMdxFrontmatter, { name: "metadata" }], |
23 |
], |
24 |
rehypePlugins: [ |
25 |
rehypeSlug, |
26 |
[ |
27 |
rehypeAutolinkHeadings, |
28 |
{ |
29 |
behavior: "append", |
30 |
properties: { className: "autolink", tabindex: -1 }, |
31 |
}, |
32 |
], |
33 |
rehypePrism, |
34 |
], |
35 |
}, |
36 |
webpack(config) { |
37 |
require("./generate-sitemap.js"); |
38 |
return config; |
39 |
}, |
40 |
}); |
41 |
|
42 |
export default withMDX(nextConfig); |