@xiee/utils
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -50,3 +50,3 @@ // build TOC using headings | ||
// check if headings are numbered | ||
toc.querySelector('span.section-number') && toc.classList.add('numbered'); | ||
toc.querySelector('span.section-number') && toc.firstElementChild.classList.add('numbered'); | ||
})(document); |
@@ -1,1 +0,1 @@ | ||
(e=>{let t;[".article",".body","article","body"].forEach((r=>{t||(t=e.querySelector(r))}));const r=t.querySelectorAll("h1, h2, h3, h4, h5, h6");if(0===r.length)return;var n=e.getElementById("TOC");let l,i;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,"")),l=e.createElement("li"),a>c)i=e.createElement("ul"),i.appendChild(l),d.appendChild(i);else if(a<c)for(let e=0;e<c-a;e++)d=d.parentNode.parentNode;a<=c&&d.parentNode.appendChild(l),d=l;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=>{let t;[".article",".body","article","body"].forEach((r=>{t||(t=e.querySelector(r))}));const r=t.querySelectorAll("h1, h2, h3, h4, h5, h6");if(0===r.length)return;var n=e.getElementById("TOC");let l,i;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,"")),l=e.createElement("li"),a>c)i=e.createElement("ul"),i.appendChild(l),d.appendChild(i);else if(a<c)for(let e=0;e<c-a;e++)d=d.parentNode.parentNode;a<=c&&d.parentNode.appendChild(l),d=l;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.firstElementChild.classList.add("numbered")})(document); |
{ | ||
"name": "@xiee/utils", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"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
48831