-
Notifications
You must be signed in to change notification settings - Fork 0
/
contentlayer.config.ts
48 lines (46 loc) · 1.22 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
import { makeSource } from 'contentlayer/source-files'
import remarkGfm from 'remark-gfm'
import rehypePrettyCode from 'rehype-pretty-code'
import rehypeSlug from 'rehype-slug'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
// Models
import { Note } from './models/note'
import { Project } from './models/project'
import { Experience } from './models/experience'
export default makeSource({
contentDirPath: 'content',
documentTypes: [Note, Project, Experience],
mdx: {
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeSlug,
[
rehypePrettyCode,
{
theme: 'nord',
onVisitLine(node: any) {
// Prevent lines from collapsing in `display: grid` mode, and allow empty
// lines to be copy/pasted
if (node.children.length === 0) {
node.children = [{ type: 'text', value: ' ' }]
}
},
onVisitHighlightedLine(node: any) {
node.properties.className = ['line--highlighted']
},
onVisitHighlightedChars(node: any) {
node.properties.className = ['word--highlighted']
},
},
],
[
rehypeAutolinkHeadings,
{
properties: {
className: ['anchor'],
},
},
],
],
},
})