@xiee/utils
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -9,3 +9,3 @@ // build TOC using headings | ||
var toc = b.getElementById('TOC'); | ||
var toc = d.getElementById('TOC'); | ||
toc?.remove(); // delete and rebuild TOC if it has been generated (e.g., by Pandoc) | ||
@@ -12,0 +12,0 @@ toc = d.createElement('div'); |
@@ -1,1 +0,1 @@ | ||
(e=>{const t=e.querySelector(".article, .body, article, body");if(!t)return;const r=t.querySelectorAll("h1, h2, h3, h4, h5, h6");if(0===r.length)return;var n=t.getElementById("TOC");let i,l;n?.remove(),(n=e.createElement("div")).id="TOC";let a,d=n,c=0;r.forEach((t=>{if(a=parseInt(t.tagName.replace(/^h/i,"")),i=e.createElement("li"),a>c)l=e.createElement("ul"),l.appendChild(i),d.appendChild(l);else if(a<c)for(let e=0;e<c-a;e++)d=d.parentNode.parentNode;a<=c&&d.parentNode.appendChild(i),d=i;const r=e.createElement("a");if(r.innerHTML=t.innerHTML,t.id)r.href="#"+t.id;else{const e=t.parentNode;e.classList.contains("section")&&e.id&&(r.href="#"+e.id)}d.appendChild(r),c=a})),t.insertBefore(n,t.firstChild),n.querySelector("span.section-number")&&n.classList.add("numbered")})(document); | ||
(e=>{const t=e.querySelector(".article, .body, article, body");if(!t)return;const r=t.querySelectorAll("h1, h2, h3, h4, h5, h6");if(0===r.length)return;var n=e.getElementById("TOC");let i,l;n?.remove(),(n=e.createElement("div")).id="TOC";let a,d=n,c=0;r.forEach((t=>{if(a=parseInt(t.tagName.replace(/^h/i,"")),i=e.createElement("li"),a>c)l=e.createElement("ul"),l.appendChild(i),d.appendChild(l);else if(a<c)for(let e=0;e<c-a;e++)d=d.parentNode.parentNode;a<=c&&d.parentNode.appendChild(i),d=i;const r=e.createElement("a");if(r.innerHTML=t.innerHTML,t.id)r.href="#"+t.id;else{const e=t.parentNode;e.classList.contains("section")&&e.id&&(r.href="#"+e.id)}d.appendChild(r),c=a})),t.insertBefore(n,t.firstChild),n.querySelector("span.section-number")&&n.classList.add("numbered")})(document); |
{ | ||
"name": "@xiee/utils", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Miscellaneous tools and utilities to manipulate HTML pages", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package