-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.config.ts
More file actions
42 lines (39 loc) · 1.09 KB
/
Copy pathsource.config.ts
File metadata and controls
42 lines (39 loc) · 1.09 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
// File: source.config.ts
import { defineDocs, defineConfig, frontmatterSchema } from "fumadocs-mdx/config";
import lastModified from "fumadocs-mdx/plugins/last-modified";
import { z } from "zod";
import { visit } from "unist-util-visit";
const forceLineNumbers = () => (tree: any) => {
visit(tree, "element", (node: any) => {
if (node.tagName === "pre" && node.children[0]?.tagName === "code") {
const codeNode = node.children[0];
codeNode.data = codeNode.data || {};
codeNode.data.meta = (codeNode.data.meta || "") + " showLineNumbers";
}
});
};
export const docs = defineDocs({
dir: "content/docs",
docs: {
schema: frontmatterSchema.extend({
icon: z.string().optional(),
badge: z.string().optional(),
}),
postprocess: {
includeProcessedMarkdown: true,
},
},
});
export default defineConfig({
plugins: [lastModified()],
mdxOptions: {
rehypeCodeOptions: {
inline: 'tailing-curly-colon',
themes: {
light: "vitesse-light",
dark: "vitesse-black",
},
},
rehypePlugins: [forceLineNumbers],
},
});