-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathsource.config.ts
More file actions
36 lines (33 loc) · 1.02 KB
/
source.config.ts
File metadata and controls
36 lines (33 loc) · 1.02 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
import { defineConfig, defineDocs } from "fumadocs-mdx/config";
import lastModified from "fumadocs-mdx/plugins/last-modified";
import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
import { remarkAdmonition } from "fumadocs-core/mdx-plugins";
import remarkGemoji from "remark-gemoji";
import { z } from "zod";
// VitePress markdown often relies on the first H1 for the title and has no
// `title` frontmatter — relax the schema accordingly. Also passthrough
// VitePress-only fields like `hero`/`features`/`layout`/`tags` so the loader
// doesn't choke on them.
const relaxedPageSchema = pageSchema
.extend({
title: z.string().optional().default("Untitled"),
})
.passthrough();
export const docs = defineDocs({
dir: "docs",
docs: {
schema: relaxedPageSchema,
postprocess: {
includeProcessedMarkdown: true,
},
},
meta: {
schema: metaSchema,
},
});
export default defineConfig({
plugins: [lastModified()],
mdxOptions: {
remarkPlugins: [remarkAdmonition, remarkGemoji],
},
});