From 5b7ccf0b671e2999b62befc729a3e517a0433728 Mon Sep 17 00:00:00 2001 From: Bertrand Yuan Date: Mon, 15 Dec 2025 23:48:10 +0800 Subject: initial commit -- the front-end prototype The initial code is base on Anirudh's work. More to see at: https://github.com/techwithanirudh/shadcn-blog Therefore, the code in this commit is under MIT license. --- source.config.ts | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 source.config.ts (limited to 'source.config.ts') diff --git a/source.config.ts b/source.config.ts new file mode 100644 index 0000000..9ff650e --- /dev/null +++ b/source.config.ts @@ -0,0 +1,55 @@ +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({ + type: 'doc', + 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; + } + }), + author: z.string(), + tags: z.array(z.string()).optional(), + image: z.string().optional(), + }), +}); + +export default defineConfig({ + lastModifiedTime: 'git', + mdxOptions: { + rehypeCodeOptions: { + inline: 'tailing-curly-colon', + themes: { + light: 'catppuccin-latte', + dark: 'catppuccin-mocha', + }, + transformers: [ + ...(rehypeCodeDefaultOptions.transformers ?? []), + transformerTwoslash(), + transformerRemoveNotationEscape(), + ], + }, + remarkPlugins: [remarkMath], + rehypePlugins: (v) => [rehypeKatex, ...v], + }, +}); -- cgit v1.2.3