-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsource.config.ts
More file actions
57 lines (55 loc) · 1.46 KB
/
source.config.ts
File metadata and controls
57 lines (55 loc) · 1.46 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
import { transformerRemoveNotationEscape } from '@shikijs/transformers';
import { rehypeCodeDefaultOptions } from 'fumadocs-core/mdx-plugins';
import {
defineCollections,
defineConfig,
frontmatterSchema,
} from 'fumadocs-mdx/config';
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;
}
}),
tags: z.array(z.string()).optional(),
categories: z.array(z.string()).optional(),
keywords: z.array(z.string()).optional(),
draft: z.boolean().optional(),
cover_url : z.string().url().optional(),
author : z.string(),
}),
type: 'doc',
});
export default defineConfig({
generateManifest: true,
lastModifiedTime: 'git',
mdxOptions: {
rehypeCodeOptions: {
inline: 'tailing-curly-colon',
themes: {
light: 'min-light',
dark: 'aurora-x',
},
transformers: [
...(rehypeCodeDefaultOptions.transformers ?? []),
transformerRemoveNotationEscape(),
],
},
remarkPlugins: [remarkMath],
rehypePlugins: (v) => [rehypeKatex, ...v],
},
});