-
Notifications
You must be signed in to change notification settings - Fork 465
Expand file tree
/
Copy pathsource.config.ts
More file actions
94 lines (90 loc) · 2.67 KB
/
Copy pathsource.config.ts
File metadata and controls
94 lines (90 loc) · 2.67 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { defineDocs, defineCollections, defineConfig } from 'fumadocs-mdx/config'
import { rehypeCodeDefaultOptions } from 'fumadocs-core/mdx-plugins'
import { z } from 'zod'
export const docs = defineDocs({
dir: 'content/docs',
})
export const blog = defineCollections({
type: 'doc',
dir: 'content/blog',
schema: z.object({
title: z.string(),
description: z.string().optional(),
date: z.string().or(z.date()),
author: z.string().optional(),
ogImage: z.string().optional(),
ogMetaImage: z.string().optional(),
ogImageWidth: z.number().optional(),
ogImageHeight: z.number().optional(),
ogImagePosition: z.string().optional(),
category: z.enum(['release', 'feature', 'guide', 'announcement']).optional(),
featured: z.boolean().optional(),
tags: z.array(z.string()).optional(),
}),
})
export const changelog = defineCollections({
type: 'doc',
dir: 'content/changelog',
schema: z.object({
title: z.string(),
description: z.string().optional(),
date: z.string().or(z.date()),
version: z.string().optional(),
ogImage: z.string().optional(),
}),
})
export default defineConfig({
mdxOptions: {
remarkCodeTabOptions: false,
remarkNpmOptions: false,
// fumadocs-core 16's remark-image fetches dimensions for external images at
// build time and hard-errors when a remote URL can't be sized (and it would
// make builds depend on third-party hosts). Leave external images untouched;
// only local images under /public get build-time sizing.
remarkImageOptions: { external: false },
// 16 switched Shiki to the JS regex engine. fumadocs only auto-collects the
// content's grammars when rehypeCodeOptions is unset, so once we set options
// we must list every language ourselves (lazy loading 404s mid-build) and map
// aliases the bundle doesn't know; anything unlisted falls back to plain text.
rehypeCodeOptions: {
...rehypeCodeDefaultOptions,
lazy: false,
langs: [
'yaml',
'bash',
'json',
'javascript',
'typescript',
'jsx',
'tsx',
'python',
'markdown',
'mdx',
'nginx',
'diff',
'sql',
'ini',
'html',
'css',
'toml',
'docker',
],
langAlias: {
...(rehypeCodeDefaultOptions.langAlias ?? {}),
sh: 'bash',
shell: 'bash',
js: 'javascript',
ts: 'typescript',
py: 'python',
md: 'markdown',
txt: 'text',
env: 'ini',
math: 'text',
mermaid: 'text',
ansi: 'text',
dockerfile: 'docker',
},
fallbackLanguage: 'text',
},
},
})