-
Notifications
You must be signed in to change notification settings - Fork 1
/
source.config.ts
53 lines (51 loc) · 1.32 KB
/
source.config.ts
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
import { transformerRemoveNotationEscape } from '@shikijs/transformers';
import { rehypeCodeDefaultOptions } from 'fumadocs-core/mdx-plugins';
import {
defineCollections,
defineConfig,
frontmatterSchema,
} from 'fumadocs-mdx/config';
import { transformerTwoslash } from 'fumadocs-twoslash';
import rehypeKatex from 'rehype-katex';
import remarkMath from 'remark-math';
import { z } from 'zod';
export const blog = defineCollections({
dir: 'content',
schema: frontmatterSchema.extend({
date: z
.string()
.or(z.date())
.transform((value, context) => {
try {
return new Date(value);
} catch {
context.addIssue({
code: z.ZodIssueCode.custom,
message: 'Invalid date',
});
return z.NEVER;
}
}),
}),
type: 'doc',
});
export default defineConfig({
generateManifest: true,
lastModifiedTime: 'git',
mdxOptions: {
rehypeCodeOptions: {
inline: 'tailing-curly-colon',
themes: {
light: 'github-light',
dark: 'tokyo-night',
},
transformers: [
...(rehypeCodeDefaultOptions.transformers ?? []),
transformerTwoslash(),
transformerRemoveNotationEscape(),
],
},
remarkPlugins: [remarkMath],
rehypePlugins: (v) => [rehypeKatex, ...v],
},
});