Commit 60c3578b70

60c3578b70fa7f49d26843e723d56966b607e59c

parent: 4cc7597fe7

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-07-30 07:09 UTC

Update Search.vue

Layout: unified · split

docs/.vitepress/theme/components/search/Search.vue +11 −2
@@ -779,8 +779,17 @@ function buildDocExcerpt(docId: string): Promise<void> {
779779 const headings = div.querySelectorAll('h1, h2, h3, h4, h5, h6')
780780 headings.forEach((heading) => {
781781 const href = heading.querySelector('a')?.getAttribute('href')
782 const anchor = href?.startsWith('#') && href.slice(1)
782 const hashIndex = href?.indexOf('#') ?? -1
783 const anchor = hashIndex >= 0 ? href!.slice(hashIndex + 1) : ''
783784 if (!anchor) return
785
786 const collapsible = heading.closest('details.custom-block') as HTMLDetailsElement | null
787 if (collapsible) {
788 collapsible.open = true
789 map.set(anchor, collapsible.outerHTML)
790 return
791 }
792
784793 let html = ''
785794 let node = heading as Element
786795 while ((node = node.nextElementSibling!) && !/^h[1-6]$/i.test(node.tagName)) {
@@ -1749,4 +1758,4 @@ svg {
17491758 text-decoration: underline;
17501759 text-underline-offset: 2px;
17511760}
1752</style>
1761</style>
\ No newline at end of file