forked from railwayapp/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
35 lines (33 loc) · 874 Bytes
/
next.config.js
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
const withPlugins = require("next-compose-plugins");
const withMdxEnhanced = require("next-mdx-enhanced");
module.exports = withPlugins([
withMdxEnhanced({
layoutPath: "src/mdxLayouts",
defaultLayout: true,
fileExtensions: ["mdx", "md"],
remarkPlugins: [
require("remark-autolink-headings"),
require("remark-slug"),
],
rehypePlugins: [],
extendFrontMatter: {
process: (mdxContent, frontMatter) => {
return {
id: makeIdFromPath(frontMatter.__resourcePath),
wordCount: mdxContent.split(/\s+/g).length,
};
},
},
})({
images: {
domains: [
"user-images.githubusercontent.com",
"railway.app",
"res.cloudinary.com",
],
},
}),
]);
function makeIdFromPath(resourcePath) {
return resourcePath.replace(".mdx", "").replace("/index", "");
}