Skip to content

docs(docusaurus): Ionic method parameters are missing descriptions (#634) #4139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions plugins/docusaurus-plugin-ionic-component-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,25 @@ function renderEvents({ events }) {
${events.map((event) => `| \`${event.event}\` | ${formatMultiline(event.docs)} | \`${event.bubbles}\` |`).join('\n')}`;
}

/**
* Formats method parameters for the optional Parameters row of each method table
* @param {*} paramsArr Array of method parameters
* @returns formatted parameters for methods table
*/
function renderParameters(paramsArr) {
if (!paramsArr.some((param) => param.docs)) {
return '';
}

const documentedParams = paramsArr.filter((param) => param.docs);
const formattedParams = documentedParams
.map((param) => {
return `**${param.name}**: ${formatMultiline(param.docs)}`;
})
.join('<br/>');
return `| **Parameters** | ${formattedParams} |`;
}

function renderMethods({ methods }) {
if (methods.length === 0) {
return 'No public methods available for this component.';
Expand All @@ -189,6 +208,7 @@ ${methods
| --- | --- |
| **Description** | ${formatMultiline(method.docs)} |
| **Signature** | \`${method.signature.replace(/\|/g, '\uff5c')}\` |
${method.parameters.length !== 0 ? renderParameters(method.parameters) : ''}
`
)
.join('\n')}
Expand Down