This commit is contained in:
Pascal Fischer
2023-05-10 02:02:11 +02:00
parent fb20ff54e2
commit 91f1025c9a

View File

@@ -48,6 +48,7 @@ function collectHeadings(sections, slugify = slugifyWithCounter()) {
if (section.tagName === 'h2' || section.tagName === 'h3') {
let title = section.title
let id = section.id
let tag = section.tag
if (section.tagName === 'h3') {
if (!output[output.length - 1]) {
throw new Error(
@@ -57,9 +58,10 @@ function collectHeadings(sections, slugify = slugifyWithCounter()) {
output[output.length - 1].children.push({
id,
title,
tag,
})
} else {
output.push({ id, title, children: [] })
output.push({ id, title, tag, children: [] })
}
}