Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/components/tableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export function TableOfContents({ignoreIds = []}: Props) {
.filter(Boolean) as TreeNode[];

// Now group them together
// We only support 2 levels of nesting,
// where the first level is assumed to be headings, and the second one is assumed to be options
// We only support 2 levels of nesting for now
const _tocItems: TreeItem[] = [];
let currentItem: TreeItem | undefined;
for (let node of nodes) {
Expand All @@ -70,7 +69,7 @@ export function TableOfContents({ignoreIds = []}: Props) {
}

// Remove groups without children
setTreeItems(_tocItems.filter(item => item.children.length > 0));
setTreeItems(_tocItems);
}, [ignoreIds]);

return (
Expand Down
Loading