Skip to content

Commit

Permalink
feat(docs): add default values for field members
Browse files Browse the repository at this point in the history
* Not implementing signatures as some option types are very convoluted which introduces a lot of visual noise in Discord channels

resolves #226
  • Loading branch information
almostSouji committed Nov 10, 2024
1 parent ea821cc commit 0b5b0f5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/functions/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ function formatItem(_item: any, _package: string, version: string, member?: stri
const lines: string[] = [[head, middlePart, tail].join(' ')];

const summary = item.summary?.summarySection;
const defaultValueBlock = item.summary?.defaultValueBlock;
const deprecationNote = item.summary?.deprecatedBlock;
const example = formatExample(item.summary?.exampleBlocks);
const defaultValue = defaultValueBlock ? formatSummary(defaultValueBlock, _package, version) : null;

if (deprecationNote?.length) {
lines.push(`${bold('[DEPRECATED]')} ${formatSummary(deprecationNote, _package, version)}`);
Expand All @@ -274,6 +276,10 @@ function formatItem(_item: any, _package: string, version: string, member?: stri
}
}

if (defaultValue?.length) {
lines.push(`Default value: ${inlineCode(defaultValue)}`);
}

return lines.join('\n');
}

Expand Down

0 comments on commit 0b5b0f5

Please sign in to comment.