-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvelite.config.ts
45 lines (43 loc) · 1.16 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeCodeTitles from 'rehype-code-titles'
import rehypeExternalLinks from 'rehype-external-links'
import rehypePrism from 'rehype-prism-plus'
import rehypeSlug from 'rehype-slug'
import remarkBreaks from 'remark-breaks'
import { defineCollection, defineConfig, s } from 'velite'
export const blogPost = defineCollection({
name: 'Post',
pattern: 'posts/**/*.mdx',
schema: s.object({
title: s.string().max(99),
date: s.string(),
description: s.string().max(999),
thumbnail: s.string(),
category: s.array(s.string().max(50)),
series: s.string().max(99).optional(),
content: s.mdx(),
}),
})
export default defineConfig({
collections: {
blogPost,
},
mdx: {
rehypePlugins: [
rehypeSlug,
rehypeCodeTitles,
[
rehypeAutolinkHeadings,
{
properties: {
className: ['anchor'],
ariaLabel: 'anchor',
},
},
],
[rehypeExternalLinks, { target: '_blank', rel: ['noopener noreffer'] }],
[rehypePrism as any, { ignoreMissing: true }],
],
remarkPlugins: [remarkBreaks],
},
})