@@ -113,16 +113,16 @@ const VITEPRESS_CONFIG: UserConfig<DefaultTheme.Config> = {
113113 const words = [ "BdApi" ] ;
114114 options . decorations ||= [ ] ;
115115 for ( const word of words ) {
116- const indexes = findAllSubstringIndexes ( code , word ) ;
117- for ( const index of indexes ) {
118- options . decorations . push ( {
119- start : index ,
120- end : index + word . length ,
121- properties : {
122- "class" : "global-bdapi" ,
123- } ,
124- } ) ;
125- }
116+ const indexes = findAllSubstringIndexes ( code , word ) ;
117+ for ( const index of indexes ) {
118+ options . decorations . push ( {
119+ start : index ,
120+ end : index + word . length ,
121+ properties : {
122+ "class" : "global-bdapi" ,
123+ } ,
124+ } ) ;
125+ }
126126 }
127127 } ,
128128 }
@@ -170,7 +170,14 @@ const VITEPRESS_CONFIG: UserConfig<DefaultTheme.Config> = {
170170 } ,
171171 } )
172172 ]
173- }
173+ } ,
174+ transformPageData : ( pageData ) => {
175+ if ( pageData . relativePath . startsWith ( "api/" ) ) {
176+ pageData . frontmatter . outline = [ 2 , 3 ] ;
177+ }
178+
179+ return pageData ;
180+ } ,
174181} ;
175182
176183
@@ -180,8 +187,11 @@ const SIDEBARS: VitePressSidebarOptions[] = [
180187 scanStartPath : "api" ,
181188 basePath : "/api/" ,
182189 resolvePath : "/api/" ,
183- useTitleFromFileHeading : true ,
190+ useTitleFromFrontmatter : true ,
191+ // useTitleFromFileHeading: true,
184192 includeRootIndexFile : true ,
193+ capitalizeEachWords : true ,
194+ collapsed : false ,
185195 sortFolderTo : "bottom" ,
186196 sortMenusByFrontmatterOrder : true ,
187197 frontmatterOrderDefaultValue : 1 ,
@@ -254,7 +264,8 @@ const SIDEBARS: VitePressSidebarOptions[] = [
254264 sortMenusByFrontmatterOrder : true ,
255265 frontmatterOrderDefaultValue : 1 ,
256266 manualSortFileNameByPriority : [ "introduction" , "basics" , "intermediate" , "advanced" ] ,
257- }
267+ } ,
258268] ;
259269
260- export default defineConfig ( withSidebar ( VITEPRESS_CONFIG , SIDEBARS ) ) ;
270+ const userConfig : Partial < UserConfig > = withSidebar ( VITEPRESS_CONFIG , SIDEBARS ) ;
271+ export default defineConfig ( userConfig ) ;
0 commit comments