@@ -73,7 +73,14 @@ export default defineConfig({
73
73
}
74
74
} ,
75
75
transformPageData ( pageData ) {
76
- if ( pageData . filePath . startsWith ( "api/" ) || pageData . filePath . startsWith ( "guide/cli/" ) ) {
76
+ if ( pageData . filePath . startsWith ( "api/" ) ) {
77
+ pageData . frontmatter . editLink = false ;
78
+ pageData . frontmatter . lastUpdated = false ;
79
+ pageData . frontmatter ||= { }
80
+ pageData . frontmatter . outline = [ 2 , 3 ] ;
81
+ }
82
+
83
+ if ( pageData . filePath . startsWith ( "guide/cli/" ) ) {
77
84
pageData . frontmatter . editLink = false ;
78
85
pageData . frontmatter . lastUpdated = false ;
79
86
}
@@ -181,13 +188,20 @@ function getApiReferenceSidebar(): typeof typedocSidebar {
181
188
}
182
189
183
190
function orderApiReferenceSidebar ( sidebar : typeof typedocSidebar ) : typeof typedocSidebar {
191
+ orderClasses ( sidebar ) ;
192
+ orderTypes ( sidebar ) ;
193
+
194
+ return sidebar ;
195
+ }
196
+
197
+ function orderClasses ( sidebar : typeof typedocSidebar ) {
184
198
const baseChatPromptWrapper = "ChatPromptWrapper" ;
185
199
const chatPromptWrapperItems : DefaultTheme . SidebarItem [ ] = [ ] ;
186
200
187
201
const classes = sidebar . find ( ( item ) => item . text === "Classes" ) ;
188
202
189
203
if ( classes == null || ! ( classes . items instanceof Array ) )
190
- return sidebar ;
204
+ return ;
191
205
192
206
( classes . items as DefaultTheme . SidebarItem [ ] ) . unshift ( {
193
207
text : "Chat wrappers" ,
@@ -222,7 +236,54 @@ function orderApiReferenceSidebar(sidebar: typeof typedocSidebar): typeof typedo
222
236
223
237
return aIndex - bIndex ;
224
238
} ) ;
225
-
226
- return sidebar ;
227
239
}
228
240
241
+ function orderTypes ( sidebar : typeof typedocSidebar ) {
242
+ const types = sidebar . find ( ( item ) => item . text === "Types" ) ;
243
+
244
+ if ( types == null || ! ( types . items instanceof Array ) )
245
+ return ;
246
+
247
+ function groupGbnfJsonSchema ( ) {
248
+ if ( types == null || ! ( types . items instanceof Array ) )
249
+ return ;
250
+
251
+ const gbnfJsonSchemaItemTitle = "GbnfJsonSchema" ;
252
+ const gbnfItemsPrefix = "GbnfJson" ;
253
+ const gbnfJsonSchemaItems : DefaultTheme . SidebarItem [ ] = [ ] ;
254
+
255
+ const gbnfJsonSchemaItem = types . items
256
+ . find ( ( item ) => item . text === gbnfJsonSchemaItemTitle ) as DefaultTheme . SidebarItem | null ;
257
+
258
+ if ( gbnfJsonSchemaItem == null )
259
+ return ;
260
+
261
+ gbnfJsonSchemaItem . collapsed = true ;
262
+ gbnfJsonSchemaItem . items = gbnfJsonSchemaItems ;
263
+
264
+ for ( const item of types . items . slice ( ) ) {
265
+ if ( item . text === gbnfJsonSchemaItemTitle || ! item . text . startsWith ( gbnfItemsPrefix ) )
266
+ continue ;
267
+
268
+ types . items . splice ( types . items . indexOf ( item ) , 1 ) ;
269
+ gbnfJsonSchemaItems . push ( item ) ;
270
+ }
271
+ }
272
+
273
+ function moveCollapseItemsToTheEnd ( ) {
274
+ if ( types == null || ! ( types . items instanceof Array ) )
275
+ return ;
276
+
277
+ types . items . sort ( ( a , b ) => {
278
+ if ( a . collapsed && ! b . collapsed )
279
+ return 1 ;
280
+ if ( ! a . collapsed && b . collapsed )
281
+ return - 1 ;
282
+
283
+ return 0 ;
284
+ } ) ;
285
+ }
286
+
287
+ groupGbnfJsonSchema ( ) ;
288
+ moveCollapseItemsToTheEnd ( ) ;
289
+ }
0 commit comments