Skip to content

Commit

Permalink
Fix: Lower heading without parent breaks build
Browse files Browse the repository at this point in the history
  • Loading branch information
xypnox committed Jan 18, 2024
1 parent 4cc28be commit 6bc7b32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/Toc.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ function buildToc(headings: Heading[]) {
if (heading.depth === 1) {
toc.push(heading);
} else {
if (!parentHeadings.has(heading.depth - 1)) {
toc.push(heading);
}
parentHeadings.get(heading.depth - 1).subheadings.push(heading);
}
});
Expand Down

0 comments on commit 6bc7b32

Please sign in to comment.