-
Notifications
You must be signed in to change notification settings - Fork 0
/
velite.config.ts
32 lines (29 loc) · 947 Bytes
/
velite.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
import { transformerTwoslash } from '@shikijs/twoslash'
import type { Route } from 'next'
import rehypePrettyCode, { type Options } from 'rehype-pretty-code'
import { defineConfig, defineCollection, s } from 'velite'
const posts = defineCollection({
name: 'Post',
pattern: 'posts/**/*.md',
schema: s
.object({
title: s.string().toLowerCase(),
description: s.string().toLowerCase(),
date: s.isodate(),
slug: s.slug('posts'),
metadata: s.metadata(),
content: s.markdown(),
})
.transform(data => ({ ...data, permalink: `/posts/${data.slug}` as Route<'/posts/${string}'> })),
})
const rehypePrettyCodeOptions: Options = {
theme: { light: 'vitesse-light', dark: 'vitesse-dark' },
transformers: [transformerTwoslash()],
}
export default defineConfig({
collections: { posts },
markdown: {
// remarkPlugins: [],
rehypePlugins: [[rehypePrettyCode, rehypePrettyCodeOptions]],
},
})