@@ -3,11 +3,12 @@ import {
3
3
defineDocumentType ,
4
4
makeSource ,
5
5
} from 'contentlayer/source-files' ;
6
- import remarkSlug from 'remark-slug' ;
7
- import remarkGfm from 'remark-gfm' ;
8
6
import remarkEmoji from 'remark-emoji' ;
9
- import { rehypeMdxCodeMeta } from './src/utils/rehype-code-meta' ;
7
+ import remarkGfm from 'remark-gfm' ;
8
+ import remarkSlug from 'remark-slug' ;
10
9
import siteConfig from './configs/site-config' ;
10
+ import { getTableOfContents } from './src/utils/mdx-utils' ;
11
+ import { rehypeMdxCodeMeta } from './src/utils/rehype-code-meta' ;
11
12
12
13
const computedFields : ComputedFields = {
13
14
slug : {
@@ -36,6 +37,7 @@ const Blog = defineDocumentType(() => ({
36
37
title : doc . title ,
37
38
description : doc . description ,
38
39
slug : `/${ doc . _raw . flattenedPath } ` ,
40
+ headings : getTableOfContents ( doc . body . raw ) ,
39
41
} ) ,
40
42
} ,
41
43
} ,
@@ -61,6 +63,7 @@ const Guides = defineDocumentType(() => ({
61
63
tags : doc . tags ,
62
64
author : doc . author ,
63
65
slug : `/${ doc . _raw . flattenedPath } ` ,
66
+ headings : getTableOfContents ( doc . body . raw ) ,
64
67
} ) ,
65
68
} ,
66
69
} ,
@@ -88,6 +91,7 @@ const Doc = defineDocumentType(() => ({
88
91
image : doc . image ,
89
92
version : doc . version ,
90
93
slug : `/${ doc . _raw . flattenedPath } ` ,
94
+ headings : getTableOfContents ( doc . body . raw ) ,
91
95
} ) ,
92
96
} ,
93
97
} ,
@@ -109,6 +113,7 @@ const FAQ = defineDocumentType(() => ({
109
113
title : doc . title ,
110
114
description : doc . description ,
111
115
slug : `/${ doc . _raw . flattenedPath } ` ,
116
+ headings : getTableOfContents ( doc . body . raw ) ,
112
117
} ) ,
113
118
} ,
114
119
} ,
0 commit comments