-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
47 lines (43 loc) · 1.23 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
import createMDX from "@next/mdx";
import rehypeKatex from "rehype-katex";
import remarkMath from "remark-math";
import rehypePrettyCode from "rehype-pretty-code";
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
images: {
remotePatterns: [
{ hostname: "imgur.com" },
{ hostname: "pics.craiyon.com" },
{ hostname: "raw.githubusercontent.com" },
],
},
};
const rehypePrettyCodeOptions = {
theme: "github-dark",
onVisitLine(node) {
// Prevent lines from collapsing in `display: grid` mode, and
// allow empty lines to be copy/pasted
if (node.children.length === 0) {
node.children = [{ type: "text", value: " " }];
}
},
// Feel free to add classNames that suit your docs
onVisitHighlightedLine(node) {
node.properties.className.push("highlighted");
},
onVisitHighlightedWord(node) {
node.properties.className = ["word"];
},
};
const withMDX = createMDX({
// Add markdown plugins here, as desired
options: {
remarkPlugins: [remarkMath],
rehypePlugins: [
[rehypeKatex, { output: "mathml" }],
[rehypePrettyCode, rehypePrettyCodeOptions],
],
},
});
export default withMDX(nextConfig);