-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathcontentlayer.config.ts
41 lines (40 loc) · 1.17 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
import { makeSource } from "contentlayer/source-files"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import rehypePrettyCode from "rehype-pretty-code"
import rehypeSlug from "rehype-slug"
import remarkGfm from "remark-gfm"
// esbuild doesn't support module aliases 😤🤌
// https://github.com/evanw/esbuild/issues/394
// https://github.com/contentlayerdev/contentlayer/issues/238
import { Post } from "./content/definitions/Post"
import { Video } from "./content/definitions/Video"
import { HEADING_LINK_ANCHOR } from "./lib/constants"
import {
rehypePrettyCodeClasses,
rehypePrettyCodeOptions,
} from "./lib/rehyePrettyCode"
export default makeSource({
contentDirPath: "content",
documentTypes: [Post, Video],
mdx: {
esbuildOptions(options) {
options.target = "esnext"
return options
},
remarkPlugins: [[remarkGfm]],
rehypePlugins: [
[rehypeSlug],
[rehypePrettyCode, rehypePrettyCodeOptions],
[rehypePrettyCodeClasses],
[
rehypeAutolinkHeadings,
{
behavior: "wrap",
properties: {
className: [HEADING_LINK_ANCHOR],
},
},
],
],
},
})