-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
contentlayer.config.ts
49 lines (45 loc) · 1.01 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
44
45
46
47
48
49
import { makeSource } from "contentlayer/source-files";
import prettyCode from "rehype-pretty-code";
import { defineDocumentType } from "contentlayer/source-files";
export const Snippet = defineDocumentType(() => ({
name: "Snippet",
filePathPattern: `snippets/**/*.mdx`,
contentType: "mdx",
fields: {
file: {
type: "string",
description: "The name of the snippet",
required: true,
},
order: {
type: "number",
description: "The order of the snippet",
required: true,
},
},
computedFields: {
slug: {
type: "string",
resolve: (_) => _._raw.sourceFileName.replace(/\.[^.$]+$/, ""),
},
},
}));
// TODO: add tsconfig import path
export default makeSource({
contentDirPath: "content",
documentTypes: [Snippet],
mdx: {
rehypePlugins: [
[
prettyCode,
{
keepBackground: false,
theme: {
dark: "github-dark",
light: "github-light",
},
},
],
],
},
});