mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
34 lines
850 B
TypeScript
34 lines
850 B
TypeScript
import { z } from "zod";
|
|
|
|
// Content Collections:
|
|
import { compileMarkdown } from "@content-collections/markdown";
|
|
import { defineCollection, defineConfig } from "@content-collections/core";
|
|
|
|
// Shiki:
|
|
import rehypeShiki from "@shikijs/rehype/core";
|
|
import { shikiHighlighter, rehypeShikiOptions } from "./src/utils/shiki";
|
|
|
|
const docs = defineCollection({
|
|
name: "docs",
|
|
directory: "src/docs",
|
|
include: "**/*.md",
|
|
schema: z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
}),
|
|
transform: async (document, context) => {
|
|
const highlighter = await shikiHighlighter();
|
|
const html = await compileMarkdown(context, document, {
|
|
rehypePlugins: [[rehypeShiki, highlighter, rehypeShikiOptions]],
|
|
});
|
|
return {
|
|
...document,
|
|
html,
|
|
};
|
|
},
|
|
});
|
|
|
|
export default defineConfig({
|
|
collections: [docs],
|
|
});
|