Skip to content

Commit 88b8f2b

Browse files
committed
Add special case for rendering @summary for functions
Resolves #2803
1 parent b35cfd2 commit 88b8f2b

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ title: Changelog
1313
- Switch from gzip to deflate for compressing assets to make output consistent across different operating systems, #2796.
1414
- `@include` and `@includeCode` now work for comments on the entry point for projects with a single entry point, #2800.
1515
- Cascaded modifier tags will no longer be copied into type literals, #2802.
16+
- `@summary` now works to describe functions within modules, #2803.
1617

1718
## v0.27.3 (2024-12-04)
1819

site/tags/summary.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ If an `@summary` tag is not specified and `--useFirstParagraphOfCommentAsSummary
1616
specified, TypeDoc will use the first paragraph of the comment as the short summary
1717
to include on the modules page.
1818

19+
For overloaded functions, the `@summary` tag may be placed on the comment for the
20+
first signature or on the comment for the function implementation.
21+
1922
## Example
2023

2124
```ts

src/lib/output/themes/default/partials/comment.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export function commentShortSummary(context: DefaultThemeRenderContext, props: R
2929
shortSummary = props.comment?.getShortSummary(context.options.getValue("useFirstParagraphOfCommentAsSummary"));
3030
}
3131

32+
if (!shortSummary?.length && props.isDeclaration() && props.signatures?.length) {
33+
return commentShortSummary(context, props.signatures[0]);
34+
}
35+
3236
if (!shortSummary?.some((part) => part.text)) return;
3337

3438
return context.displayParts(shortSummary);

0 commit comments

Comments
 (0)