-
Notifications
You must be signed in to change notification settings - Fork 0
/
contentlayer.config.ts
43 lines (40 loc) · 1.19 KB
/
contentlayer.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
// @ts-nocheck
import { defineDocumentType, makeSource } from 'contentlayer2/source-files';
// import rehypePrism from "rehype-prism-plus";
// import rehypeCodeTitles from "rehype-code-titles";
import rehypePrettyCode from "rehype-pretty-code";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
import { Theme } from "./styles/rehype/theme";
export const Note = defineDocumentType(() => ({
name: "Note",
filePathPattern: `**/*.mdx`,
contentType: "mdx",
fields: {
title: { type: "string", required: true },
date: { type: "date", required: true },
tags: { type: "list", of: { type: "string" } },
description: { type: "string", required: false },
authors: { type: "list", of: { type: "string" } },
visible: { type: "boolean", required: false, default: true },
},
computedFields: {
url: {
type: "string",
resolve: (note) => `/notes/${note._raw.flattenedPath}`,
},
},
}));
export default makeSource({
contentDirPath: "notes",
documentTypes: [Note],
mdx: {
rehypePlugins: [
// rehypeCodeTitles,
// rehypePrism
[rehypePrettyCode, { theme: Theme }],
rehypeSlug,
[rehypeAutolinkHeadings, { behaviour: "wrap" }],
],
},
});