修复当小标题为链接时,toc生成错误的bug

This commit is contained in:
MeiK
2022-09-19 21:22:46 +08:00
parent d668de73d4
commit ff97bbc0a7

View File

@@ -30,7 +30,7 @@ function getToc() {
const a = document.createElement('a'); const a = document.createElement('a');
a.classList.add("filter-item", "SelectMenu-item", "ws-normal", "wb-break-word", "line-clamp-2", "py-1", "toc-item"); a.classList.add("filter-item", "SelectMenu-item", "ws-normal", "wb-break-word", "line-clamp-2", "py-1", "toc-item");
a.href = `#${h.id}`; a.href = `#${h.id}`;
a.innerText = h.innerHTML; a.innerText = h.innerText;
a.style.paddingLeft = `${size * 12}px`; a.style.paddingLeft = `${size * 12}px`;
toc_list.appendChild(a); toc_list.appendChild(a);
} }