Skip to content

Commit c2c1289

Browse files
committed
Fix @categoryDescription, @groupDescription on modules
1 parent 72b4054 commit c2c1289

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ title: Changelog
77
### Bug Fixes
88

99
- Fixed automatic discovery of entry points in packages mode.
10+
- Fixed handling of `@categoryDescription` and `@groupDescription` on module pages, #2787.
1011

1112
## v0.27.0 (2024-11-27)
1213

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function moduleReflection(context: DefaultThemeRenderContext, mod: Declar
2929
</section>
3030
)}
3131

32-
{sections.map(({ title, children }) => {
32+
{sections.map(({ title, children, description }) => {
3333
context.page.startNewSection(title);
3434

3535
return (
@@ -39,6 +39,11 @@ export function moduleReflection(context: DefaultThemeRenderContext, mod: Declar
3939
{context.icons.chevronDown()} {title}
4040
</h2>
4141
</summary>
42+
{description && (
43+
<div class="tsd-comment tsd-typography">
44+
<Raw html={context.markdown(description)} />
45+
</div>
46+
)}
4247
<dl class="tsd-member-summaries">
4348
{children.map((item) => context.moduleMemberSummary(item))}
4449
</dl>

src/lib/output/themes/lib.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { DefaultThemeRenderContext } from "../index.js";
22
import {
3+
type CommentDisplayPart,
34
type ContainerReflection,
45
DeclarationReflection,
6+
type DocumentReflection,
57
ProjectReflection,
68
ReferenceReflection,
79
type Reflection,
@@ -189,16 +191,23 @@ export function getHierarchyRoots(project: ProjectReflection): DeclarationReflec
189191
return result;
190192
}
191193

194+
export interface MemberSections {
195+
title: string;
196+
description?: CommentDisplayPart[];
197+
children: Array<DocumentReflection | DeclarationReflection>;
198+
}
199+
192200
export function getMemberSections(
193201
parent: ContainerReflection,
194202
childFilter: (refl: Reflection) => boolean = () => true,
195-
) {
203+
): MemberSections[] {
196204
if (parent.categories?.length) {
197205
return filterMap(parent.categories, (cat) => {
198206
const children = cat.children.filter(childFilter);
199207
if (!children.length) return;
200208
return {
201209
title: cat.title,
210+
description: cat.description,
202211
children,
203212
};
204213
});
@@ -212,6 +221,7 @@ export function getMemberSections(
212221
if (!children.length) return;
213222
return {
214223
title: `${group.title} - ${cat.title}`,
224+
description: cat.description,
215225
children,
216226
};
217227
});
@@ -221,6 +231,7 @@ export function getMemberSections(
221231
if (!children.length) return [];
222232
return {
223233
title: group.title,
234+
description: group.description,
224235
children,
225236
};
226237
});

0 commit comments

Comments
 (0)