From 8b851916bb694f29fcc1dd905ed6ac4c2cee2c49 Mon Sep 17 00:00:00 2001 From: Amauri Dias Date: Thu, 18 Jul 2024 00:31:30 -0300 Subject: [PATCH] fix: hash link parser docusaurus version 3 --- packages/docusaurus-search-local/src/server/parse.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-search-local/src/server/parse.ts b/packages/docusaurus-search-local/src/server/parse.ts index 1ccb6b0..60ade8e 100644 --- a/packages/docusaurus-search-local/src/server/parse.ts +++ b/packages/docusaurus-search-local/src/server/parse.ts @@ -124,7 +124,10 @@ export function html2text( // # .not("a[aria-hidden=true], a.hash-link") .text(); - const hash = $(heading).find("a.hash-link").attr("href") || ""; + + const linkHash = $(heading).find("a.hash-link").attr("href") || ""; + const [, hashPart] = linkHash.split("#"); + const hash = hashPart ? `#${hashPart}` : ""; let $sectionElements; if ($(heading).parents(".markdown").length === 0) {