From ddc83aa72c345af1f2305f52585ce999dabdecd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E4=BA=91=E8=8B=8D=E7=8B=97?= Date: Sun, 14 Apr 2024 22:13:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20#119?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hexo-theme-async-ts/src/init.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hexo-theme-async-ts/src/init.ts b/packages/hexo-theme-async-ts/src/init.ts index 33ab4efe..de71df72 100644 --- a/packages/hexo-theme-async-ts/src/init.ts +++ b/packages/hexo-theme-async-ts/src/init.ts @@ -298,8 +298,8 @@ export function InitToc() { if (toc.post_title) { postToc.querySelectorAll('.trm-toc-link').forEach(item => { - const id = item.getAttribute('href'); - const title = utils.q(id); + const id = item.getAttribute('href').replace(/^#/, ''); + const title = utils.q(`[id="${id}"]`); if (!title) return; const span = document.createElement('span'); span.className = 'trm-toc-icon';