diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad90d33e..5bd631e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ title: Changelog - Switch from gzip to deflate for compressing assets to make output consistent across different operating systems, #2796. - `@include` and `@includeCode` now work for comments on the entry point for projects with a single entry point, #2800. - Cascaded modifier tags will no longer be copied into type literals, #2802. +- `@summary` now works to describe functions within modules, #2803. ## v0.27.3 (2024-12-04) diff --git a/site/tags/summary.md b/site/tags/summary.md index ea42f12c7..9ab84111a 100644 --- a/site/tags/summary.md +++ b/site/tags/summary.md @@ -16,6 +16,9 @@ If an `@summary` tag is not specified and `--useFirstParagraphOfCommentAsSummary specified, TypeDoc will use the first paragraph of the comment as the short summary to include on the modules page. +For overloaded functions, the `@summary` tag may be placed on the comment for the +first signature or on the comment for the function implementation. + ## Example ```ts diff --git a/src/lib/output/themes/default/partials/comment.tsx b/src/lib/output/themes/default/partials/comment.tsx index 164f3e5e7..d09152afb 100644 --- a/src/lib/output/themes/default/partials/comment.tsx +++ b/src/lib/output/themes/default/partials/comment.tsx @@ -29,6 +29,10 @@ export function commentShortSummary(context: DefaultThemeRenderContext, props: R shortSummary = props.comment?.getShortSummary(context.options.getValue("useFirstParagraphOfCommentAsSummary")); } + if (!shortSummary?.length && props.isDeclaration() && props.signatures?.length) { + return commentShortSummary(context, props.signatures[0]); + } + if (!shortSummary?.some((part) => part.text)) return; return context.displayParts(shortSummary);