diff --git a/packages/docusaurus-search-local/src/server/parse.ts b/packages/docusaurus-search-local/src/server/parse.ts index 4f59ed7..59592e6 100644 --- a/packages/docusaurus-search-local/src/server/parse.ts +++ b/packages/docusaurus-search-local/src/server/parse.ts @@ -125,8 +125,8 @@ export function html2text( .not("a[aria-hidden=true], a.hash-link") .text(); const linkHash = $(heading).find("a.hash-link").attr("href") || ""; - const [, hashPart] = linkHash.split("#"); - const hash = hashPart ? `#${hashPart}` : ""; + const [, ...hashParts] = linkHash.split("#"); + const hash = hashParts.length ? `#${hashParts.join("#")}` : ""; let $sectionElements; if ($(heading).parents(".markdown").length === 0) { // $(heading) is the page title