SECURITY: Render TOC items as plain text (#44)

This commit is contained in:
Jarek Radosz
2022-10-03 21:10:05 +02:00
committed by GitHub
parent d6b02afbc2
commit f80c215a28
4 changed files with 33 additions and 4 deletions
@@ -286,9 +286,9 @@ export default {
li.classList.add("d-toc-item");
li.classList.add(`d-toc-${clonedNode.tagName.toLowerCase()}`);
li.innerHTML = `<a href="#" data-d-toc="${clonedNode.getAttribute("id")}">${
clonedNode.textContent
}</a>`;
const id = clonedNode.getAttribute("id");
li.innerHTML = `<a href="#" data-d-toc="${id}"></a>`;
li.querySelector("a").innerText = clonedNode.textContent.trim();
clonedNode.remove();
return li;