Skip to content

Commit b1c956c

Browse files
committed
fix(search): properly group nested headings
fixes #2238
1 parent 17558db commit b1c956c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node/plugins/localSearchPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ function splitPageIntoSections(html: string) {
250250
const anchor = headingResult?.[2] ?? ''
251251
const content = result[i + 2]
252252
if (!title || !content) continue
253-
const titles = [...parentTitles]
253+
const titles = parentTitles.slice(0, level)
254254
titles[level] = title
255255
sections.push({ anchor, titles, text: getSearchableText(content) })
256256
if (level === 0) {

0 commit comments

Comments
 (0)