improve TOC style somewhat

This commit is contained in:
outfoxxed 2025-06-08 17:40:00 -07:00
parent 415c5f56ef
commit 55e272eb2e
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
19 changed files with 60 additions and 54 deletions

View file

@ -28,9 +28,16 @@ export function buildHierarchy(headings: ConfigHeading[]) {
if (heading.depth === 1) {
toc.push(heading);
} else {
parentHeadings
.get(heading.depth - 1)
.subheadings.push(heading);
let depth = heading.depth - 1;
let parent = null;
while (!parent && depth != 0) {
parent = parentHeadings.get(depth);
depth -= 1;
}
if (parent) parent.subheadings.push(heading);
else toc.push(heading);
}
}
return toc;