@@ -15,6 +15,7 @@ import type { APIPageClientOptions } from './client';
1515import { cn } from 'fumadocs-ui/utils/cn' ;
1616import type { CodeUsageGenerator , ResponseTab } from './operation/api-example' ;
1717import { ApiProvider } from './contexts/api' ;
18+ import { Heading } from 'fumadocs-ui/components/heading' ;
1819
1920type Awaitable < T > = T | Promise < T > ;
2021
@@ -160,19 +161,26 @@ export function createAPIPage(
160161 ? dereferenced . servers
161162 : [ { url : '/' } ] ;
162163
164+ const slugger = new Slugger ( ) ;
163165 const ctx : RenderContext = {
164166 schema : processed ,
165167 proxyUrl : server . options . proxyUrl ,
166- showResponseSchema : options . showResponseSchema ,
167- shikiOptions : options . shikiOptions ,
168- generateTypeScriptSchema : options . generateTypeScriptSchema ,
169- generateCodeSamples : options . generateCodeSamples ,
168+ ...options ,
170169 servers,
171170 mediaAdapters : {
172171 ...defaultAdapters ,
173172 ...options . mediaAdapters ,
174173 } ,
175- slugger : new Slugger ( ) ,
174+ slugger,
175+ renderHeading ( depth , text ) {
176+ const id = slugger . slug ( text ) ;
177+
178+ return (
179+ < Heading id = { id } key = { id } as = { `h${ depth } ` as `h1`} >
180+ { text }
181+ </ Heading >
182+ ) ;
183+ } ,
176184 } ;
177185
178186 return < APIPage { ...props } ctx = { ctx } /> ;
0 commit comments