Skip to content

Function: groupEntries()

ts
function groupEntries(entries, groups?): EntryGroup[];

Defined in: emitters/markdown/src/render.ts:169

Bucket records into display groups for the sidebar and index. A record with @group Foo joins a group labelled Foo; a record without one falls back to its KIND_GROUPS kind label. Order: any groups labels first (in that order), then the kind groups in KIND_GROUPS order, then any remaining custom groups in first-appearance order. Empty groups are dropped. A custom @group value equal to a kind label merges into that kind group.

Records are name-sorted internally, so the result is deterministic regardless of input order — both within each group and across the first-appearance custom groups. (buildCssApi already name-sorts; this keeps direct callers of buildSidebar/renderIndex consistent with it.)

Parameters

entries

readonly CssDocEntry[]

The records to group.

groups?

readonly string[]

Optional explicit label order; see RenderIndexOptions.groups.

Returns

EntryGroup[]

The non-empty groups, in display order.

Released under the MIT License