@@ -27,70 +27,82 @@ export const getMemberPrefix = (model) => {
2727 * @param {import('typedoc-plugin-markdown').MarkdownThemeContext } ctx
2828 * @returns {import('typedoc-plugin-markdown').MarkdownThemeContext['partials'] }
2929 */
30- export default ( ctx ) => ( {
31- ...ctx . partials ,
32- ...typePartials ,
30+ export default ( ctx ) => {
31+ const baseComment = ctx . partials . comment ;
3332
34- signature ( model , options ) {
35- const comment = options . multipleSignatures
36- ? model . comment
37- : model . comment || model . parent ?. comment ;
33+ return {
34+ ...ctx . partials ,
35+ ...typePartials ,
3836
39- const stability = ctx . helpers . stabilityBlockquote ( comment ) ;
37+ comment ( model , options ) {
38+ return (
39+ baseComment . call ( ctx , model , { ...options , showTags : false } ) +
40+ ctx . helpers . renderExamples ( model )
41+ ) ;
42+ } ,
4043
41- return [
42- stability ,
43- stability && "" ,
44- model . typeParameters ?. length &&
45- ctx . partials . typeParametersList ( model . typeParameters , {
46- headingLevel : options . headingLevel ,
47- } ) ,
48- model . parameters ?. length &&
49- ctx . partials . parametersList ( model . parameters , {
50- headingLevel : options . headingLevel ,
51- } ) ,
52- ctx . helpers . typedListItem ( {
53- label : "Returns" ,
54- type : model . type ?? "void" ,
55- comment : model . comment ?. getTag ( "@returns" ) ,
56- } ) ,
57- "" ,
58- comment &&
59- ctx . partials . comment ( comment , {
60- headingLevel : options . headingLevel ,
61- showTags : false ,
44+ signature ( model , options ) {
45+ const comment = options . multipleSignatures
46+ ? model . comment
47+ : model . comment || model . parent ?. comment ;
48+
49+ const stability = ctx . helpers . stabilityBlockquote ( comment ) ;
50+
51+ return [
52+ stability ,
53+ stability && "" ,
54+ model . typeParameters ?. length &&
55+ ctx . partials . typeParametersList ( model . typeParameters , {
56+ headingLevel : options . headingLevel ,
57+ } ) ,
58+ model . parameters ?. length &&
59+ ctx . partials . parametersList ( model . parameters , {
60+ headingLevel : options . headingLevel ,
61+ } ) ,
62+ ctx . helpers . typedListItem ( {
63+ label : "Returns" ,
64+ type : model . type ?? "void" ,
65+ comment : model . comment ?. getTag ( "@returns" ) ,
6266 } ) ,
63- ]
64- . filter ( ( x ) => typeof x === "string" || Boolean ( x ) )
65- . join ( "\n" ) ;
66- } ,
67+ "" ,
68+ comment &&
69+ baseComment . call ( ctx , comment , {
70+ headingLevel : options . headingLevel ,
71+ showTags : false ,
72+ } ) ,
73+ ctx . helpers . renderExamples ( comment ) ,
74+ ]
75+ . filter ( ( x ) => typeof x === "string" || Boolean ( x ) )
76+ . join ( "\n" ) ;
77+ } ,
6778
68- memberTitle ( model ) {
69- const prefix = getMemberPrefix ( model ) ;
70- const params = model . signatures ?. [ 0 ] ?. parameters ;
79+ memberTitle ( model ) {
80+ const prefix = getMemberPrefix ( model ) ;
81+ const params = model . signatures ?. [ 0 ] ?. parameters ;
7182
72- if ( ! params ) {
73- return `${ prefix } \`${ model . name } \`` ;
74- }
83+ if ( ! params ) {
84+ return `${ prefix } \`${ model . name } \`` ;
85+ }
7586
76- const paramsString = params
77- . map ( ( param , index ) => {
78- const paramName = param . name ;
79- if ( param . flags ?. isOptional ) {
80- // For optional params, wrap comma + name in brackets (except for first param)
81- return index === 0 ? `[${ paramName } ]` : `[, ${ paramName } ]` ;
82- } else {
83- // For required params, add comma separator (except for first param)
84- return index === 0 ? paramName : `, ${ paramName } ` ;
85- }
86- } )
87- . join ( "" ) ;
87+ const paramsString = params
88+ . map ( ( param , index ) => {
89+ const paramName = param . name ;
90+ if ( param . flags ?. isOptional ) {
91+ // For optional params, wrap comma + name in brackets (except for first param)
92+ return index === 0 ? `[${ paramName } ]` : `[, ${ paramName } ]` ;
93+ } else {
94+ // For required params, add comma separator (except for first param)
95+ return index === 0 ? paramName : `, ${ paramName } ` ;
96+ }
97+ } )
98+ . join ( "" ) ;
8899
89- return `${ prefix } \`${ model . name } (${ paramsString } )\`` ;
90- } ,
100+ return `${ prefix } \`${ model . name } (${ paramsString } )\`` ;
101+ } ,
91102
92- parametersList : ctx . helpers . typedList ,
93- typedParametersList : ctx . helpers . typedList ,
94- typeDeclarationList : ctx . helpers . typedList ,
95- propertiesTable : ctx . helpers . typedList ,
96- } ) ;
103+ parametersList : ctx . helpers . typedList ,
104+ typedParametersList : ctx . helpers . typedList ,
105+ typeDeclarationList : ctx . helpers . typedList ,
106+ propertiesTable : ctx . helpers . typedList ,
107+ } ;
108+ } ;
0 commit comments