fix(search): properly group nested headings

fixes #2238
pull/2241/head
Divyansh Singh 2 years ago
parent 17558db76b
commit b1c956ce99

@ -250,7 +250,7 @@ function splitPageIntoSections(html: string) {
const anchor = headingResult?.[2] ?? '' const anchor = headingResult?.[2] ?? ''
const content = result[i + 2] const content = result[i + 2]
if (!title || !content) continue if (!title || !content) continue
const titles = [...parentTitles] const titles = parentTitles.slice(0, level)
titles[level] = title titles[level] = title
sections.push({ anchor, titles, text: getSearchableText(content) }) sections.push({ anchor, titles, text: getSearchableText(content) })
if (level === 0) { if (level === 0) {

Loading…
Cancel
Save