Skip to content

Commit

Permalink
fix(localSearch): remove empty titles that may appear in search resul…
Browse files Browse the repository at this point in the history
…ts (#3665)
  • Loading branch information
zonemeen committed Mar 18, 2024
1 parent e13f932 commit f7aef3c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node/plugins/localSearchPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ function* splitPageIntoSections(html: string) {
const anchor = headingResult?.[2] ?? ''
const content = result[i + 2]
if (!title || !content) continue
const titles = parentTitles.slice(0, level)
let titles = parentTitles.slice(0, level)
titles[level] = title
titles = titles.filter(Boolean)
yield { anchor, titles, text: getSearchableText(content) }
if (level === 0) {
parentTitles = [title]
Expand Down

0 comments on commit f7aef3c

Please sign in to comment.