@@ -3,11 +3,12 @@ import {
33 defineDocumentType ,
44 makeSource ,
55} from 'contentlayer/source-files' ;
6- import remarkSlug from 'remark-slug' ;
7- import remarkGfm from 'remark-gfm' ;
86import 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' ;
109import siteConfig from './configs/site-config' ;
10+ import { getTableOfContents } from './src/utils/mdx-utils' ;
11+ import { rehypeMdxCodeMeta } from './src/utils/rehype-code-meta' ;
1112
1213const computedFields : ComputedFields = {
1314 slug : {
@@ -36,6 +37,7 @@ const Blog = defineDocumentType(() => ({
3637 title : doc . title ,
3738 description : doc . description ,
3839 slug : `/${ doc . _raw . flattenedPath } ` ,
40+ headings : getTableOfContents ( doc . body . raw ) ,
3941 } ) ,
4042 } ,
4143 } ,
@@ -61,6 +63,7 @@ const Guides = defineDocumentType(() => ({
6163 tags : doc . tags ,
6264 author : doc . author ,
6365 slug : `/${ doc . _raw . flattenedPath } ` ,
66+ headings : getTableOfContents ( doc . body . raw ) ,
6467 } ) ,
6568 } ,
6669 } ,
@@ -88,6 +91,7 @@ const Doc = defineDocumentType(() => ({
8891 image : doc . image ,
8992 version : doc . version ,
9093 slug : `/${ doc . _raw . flattenedPath } ` ,
94+ headings : getTableOfContents ( doc . body . raw ) ,
9195 } ) ,
9296 } ,
9397 } ,
@@ -109,6 +113,7 @@ const FAQ = defineDocumentType(() => ({
109113 title : doc . title ,
110114 description : doc . description ,
111115 slug : `/${ doc . _raw . flattenedPath } ` ,
116+ headings : getTableOfContents ( doc . body . raw ) ,
112117 } ) ,
113118 } ,
114119 } ,
0 commit comments