feat: 初始化项目并添加多个功能组件
style: 调整UI组件样式和布局 docs: 更新README和添加文档内容 chore: 添加依赖项和配置文件 fix: 修复一些小问题和优化代码 perf: 优化性能相关代码 refactor: 重构部分组件结构 test: 添加测试相关文件 build: 更新构建配置 ci: 添加CI配置文件
This commit is contained in:
34
content-collections.ts
Normal file
34
content-collections.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { defineCollection, defineConfig } from "@content-collections/core";
|
||||
import { compileMDX } from "@content-collections/mdx";
|
||||
import remarkGfm from "remark-gfm";
|
||||
import { z } from "zod";
|
||||
import { remarkCodeMeta } from "./src/lib/remark-code-meta";
|
||||
|
||||
const posts = defineCollection({
|
||||
name: "posts",
|
||||
directory: "content",
|
||||
include: "**/*.mdx",
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
publishedAt: z.string(),
|
||||
updatedAt: z.string().optional(),
|
||||
author: z.string().optional(),
|
||||
summary: z.string(),
|
||||
image: z.string().optional(),
|
||||
content: z.string(),
|
||||
}),
|
||||
transform: async (document, context) => {
|
||||
const mdx = await compileMDX(context, document, {
|
||||
remarkPlugins: [remarkGfm, remarkCodeMeta],
|
||||
});
|
||||
return {
|
||||
...document,
|
||||
mdx,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default defineConfig({
|
||||
collections: [posts],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user