@@ -218,9 +218,69 @@ class ClerkMarkdownThemeContext extends MarkdownThemeContext {
218
218
const customizedModel = model ;
219
219
customizedModel . typeParameters = undefined ;
220
220
221
- const output = superPartials . memberWithGroups ( customizedModel , options ) ;
221
+ // Extract the Accessors group (if any) and prevent default rendering for it
222
+ const originalGroups = customizedModel . groups ;
223
+ const accessorsGroup = originalGroups ?. find ( g => g . title === 'Accessors' ) ;
224
+ const groupsWithoutAccessors = originalGroups ?. filter ( g => g . title !== 'Accessors' ) ;
225
+
226
+ customizedModel . groups = groupsWithoutAccessors ;
227
+ const nonAccessorOutput = superPartials . memberWithGroups ( customizedModel , options ) ;
228
+ customizedModel . groups = originalGroups ;
229
+
230
+ /** @type {string[] } */
231
+ const md = [ nonAccessorOutput ] ;
232
+
233
+ if ( accessorsGroup && accessorsGroup . children && accessorsGroup . children . length > 0 ) {
234
+ md . push ( '\n\n## Accessors\n' ) ;
235
+ // Table header
236
+ // This needs to be 'Property' instead of 'Accessor' so that clerk.com renders it correctly
237
+ md . push ( '| Property | Type | Description |' ) ;
238
+ md . push ( '| --- | --- | --- |' ) ;
239
+
240
+ for ( const child of accessorsGroup . children ) {
241
+ /** @type {import('typedoc').DeclarationReflection } */
242
+ // @ts -ignore - child is a DeclarationReflection for accessor members
243
+ const decl = child ;
244
+ // Name and anchor id
245
+ const name = decl . name ;
246
+ const id = name . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 ] / g, '' ) ;
247
+
248
+ // Resolve the accessor type from the getter signature
249
+ /** @type {any } */
250
+ const getterSig = /** @type {any } */ ( decl ) . getSignature ;
251
+ /** @type {any } */
252
+ const setterSig = /** @type {any } */ ( decl ) . setSignature ;
253
+ let typeStr = '' ;
254
+ if ( getterSig ?. type ) {
255
+ typeStr = this . partials . someType ( getterSig . type ) ;
256
+ } else if ( setterSig ?. parameters ?. [ 0 ] ?. type ) {
257
+ typeStr = this . partials . someType ( setterSig . parameters [ 0 ] . type ) ;
258
+ } else if ( decl . type ) {
259
+ typeStr = this . partials . someType ( decl . type ) ;
260
+ }
222
261
223
- return output ;
262
+ // Prefer comment on the getter signature; fallback to declaration comment
263
+ const summary = getterSig ?. comment ?. summary ?? decl . comment ?. summary ?? setterSig ?. comment ?. summary ;
264
+ const description = Array . isArray ( summary )
265
+ ? summary . reduce ( ( acc , curr ) => acc + ( curr . text || '' ) , '' )
266
+ : '' ;
267
+
268
+ md . push ( `| <a id="${ id } "></a> \`${ escapeChars ( name ) } \` | ${ typeStr } | ${ description } |` ) ;
269
+ }
270
+ }
271
+
272
+ return md . join ( '\n' ) ;
273
+ } ,
274
+ /**
275
+ * Suppress default per-accessor member rendering; table is rendered in memberWithGroups instead.
276
+ * @param {import('typedoc').DeclarationReflection } model
277
+ * @param {{ headingLevel: number, nested?: boolean } } options
278
+ */
279
+ member : ( model , options ) => {
280
+ if ( model . kind === ReflectionKind . Accessor ) {
281
+ return '' ;
282
+ }
283
+ return superPartials . member ( model , options ) ;
224
284
} ,
225
285
/**
226
286
* This hides the "Type parameters" section and the declaration title from the output
@@ -412,6 +472,17 @@ ${tabs}
412
472
* Hide "Extends" and "Extended by" sections
413
473
*/
414
474
hierarchy : ( ) => '' ,
475
+ /**
476
+ * @param {import('typedoc').DeclarationReflection } model
477
+ */
478
+ accessor : model => {
479
+ // Fallback single-row rendering if used directly elsewhere
480
+ const name = model . name ;
481
+ const typeStr = model . getSignature ?. type ? this . partials . someType ( model . getSignature . type ) : '' ;
482
+ const summary = model . getSignature ?. comment ?. summary ?? model . comment ?. summary ;
483
+ const description = Array . isArray ( summary ) ? summary . reduce ( ( acc , curr ) => acc + ( curr . text || '' ) , '' ) : '' ;
484
+ return '| ' + '`' + escapeChars ( name ) + '`' + ' | ' + typeStr + ' | ' + description + ' |' ;
485
+ } ,
415
486
} ;
416
487
}
417
488
}
0 commit comments