fix(localSearch): remove empty titles that may appear in search results (#3665)

pull/3679/head
烽宁 4 months ago committed by GitHub
parent e13f93292c
commit f7aef3ca23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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]

Loading…
Cancel
Save