File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
plugins/docusaurus-plugin-ionic-component-api Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,25 @@ function renderEvents({ events }) {
173173${ events . map ( ( event ) => `| \`${ event . event } \` | ${ formatMultiline ( event . docs ) } | \`${ event . bubbles } \` |` ) . join ( '\n' ) } `;
174174}
175175
176+ /**
177+ * Formats method parameters for the optional Parameters row of each method table
178+ * @param {* } paramsArr Array of method parameters
179+ * @returns formatted parameters for methods table
180+ */
181+ function renderParameters ( paramsArr ) {
182+ if ( ! paramsArr . some ( ( param ) => param . docs ) ) {
183+ return '' ;
184+ }
185+
186+ const documentedParams = paramsArr . filter ( ( param ) => param . docs ) ;
187+ const formattedParams = documentedParams
188+ . map ( ( param ) => {
189+ return `**${ param . name } **: ${ formatMultiline ( param . docs ) } ` ;
190+ } )
191+ . join ( '<br/>' ) ;
192+ return `| **Parameters** | ${ formattedParams } |` ;
193+ }
194+
176195function renderMethods ( { methods } ) {
177196 if ( methods . length === 0 ) {
178197 return 'No public methods available for this component.' ;
@@ -189,6 +208,7 @@ ${methods
189208| --- | --- |
190209| **Description** | ${ formatMultiline ( method . docs ) } |
191210| **Signature** | \`${ method . signature . replace ( / \| / g, '\uff5c' ) } \` |
211+ ${ method . parameters . length !== 0 ? renderParameters ( method . parameters ) : '' }
192212`
193213 )
194214 . join ( '\n' ) }
You can’t perform that action at this time.
0 commit comments