Skip to content

Commit f7aef3c

Browse files
authoredMar 18, 2024··
fix(localSearch): remove empty titles that may appear in search results (#3665)
1 parent e13f932 commit f7aef3c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/node/plugins/localSearchPlugin.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ function* splitPageIntoSections(html: string) {
235235
const anchor = headingResult?.[2] ?? ''
236236
const content = result[i + 2]
237237
if (!title || !content) continue
238-
const titles = parentTitles.slice(0, level)
238+
let titles = parentTitles.slice(0, level)
239239
titles[level] = title
240+
titles = titles.filter(Boolean)
240241
yield { anchor, titles, text: getSearchableText(content) }
241242
if (level === 0) {
242243
parentTitles = [title]

0 commit comments

Comments
 (0)
Please sign in to comment.