From b1c956ce99505316842c157c76a4ec051eb7610b Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 17 Apr 2023 00:17:50 +0530 Subject: [PATCH] fix(search): properly group nested headings fixes #2238 --- src/node/plugins/localSearchPlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/plugins/localSearchPlugin.ts b/src/node/plugins/localSearchPlugin.ts index 6f3908f2..adc7848a 100644 --- a/src/node/plugins/localSearchPlugin.ts +++ b/src/node/plugins/localSearchPlugin.ts @@ -250,7 +250,7 @@ function splitPageIntoSections(html: string) { const anchor = headingResult?.[2] ?? '' const content = result[i + 2] if (!title || !content) continue - const titles = [...parentTitles] + const titles = parentTitles.slice(0, level) titles[level] = title sections.push({ anchor, titles, text: getSearchableText(content) }) if (level === 0) {