@xiee/utils
Advanced tools
Comparing version 1.13.43 to 1.13.44
@@ -5,4 +5,3 @@ // add line numbers to code blocks for <code class="line-numbers" [data-start=*]> | ||
const s = '<span data-line-number=""></span>', sel = 'span[data-line-number]'; | ||
if (!el.classList.contains('line-numbers') || el.parentNode.tagName !== 'PRE' | ||
|| el.querySelector(sel)) return; | ||
if (el.querySelector(sel)) return; | ||
el.innerHTML = s + el.innerHTML.replace(/\n(?=.|\s)/g, '\n' + s); | ||
@@ -17,7 +16,3 @@ let n1 = +el.dataset.start; if (isNaN(n1)) n1 = 1; | ||
} | ||
function addAll(e) { | ||
e ? (e.grammar && addNum(e.element)) : | ||
document.querySelectorAll('pre > code.line-numbers:first-child').forEach(addNum); | ||
} | ||
window.Prism?.hooks ? Prism.hooks.add('complete', addAll) : addAll(); | ||
addEventListener('load', e => document.querySelectorAll('pre > code.line-numbers:first-child').forEach(addNum)); | ||
})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{function e(e){const n='<span data-line-number=""></span>',t="span[data-line-number]";if(!e.classList.contains("line-numbers")||"PRE"!==e.parentNode.tagName||e.querySelector(t))return;e.innerHTML=n+e.innerHTML.replace(/\n(?=.|\s)/g,"\n"+n);let r=+e.dataset.start;isNaN(r)&&(r=1);const a=e.querySelectorAll(t),l=(""+(r-1+a.length)).length;a.forEach((e=>{let n=""+r++,t=l-n.length;t>0&&(n="0".repeat(t)+n),e.dataset.lineNumber=n}))}function n(n){n?n.grammar&&e(n.element):document.querySelectorAll("pre > code.line-numbers:first-child").forEach(e)}window.Prism?.hooks?Prism.hooks.add("complete",n):n()})(); | ||
(()=>{function e(e){const n='<span data-line-number=""></span>',t="span[data-line-number]";if(e.querySelector(t))return;e.innerHTML=n+e.innerHTML.replace(/\n(?=.|\s)/g,"\n"+n);let r=+e.dataset.start;isNaN(r)&&(r=1);const a=e.querySelectorAll(t),l=(""+(r-1+a.length)).length;a.forEach((e=>{let n=""+r++,t=l-n.length;t>0&&(n="0".repeat(t)+n),e.dataset.lineNumber=n}))}addEventListener("load",(n=>document.querySelectorAll("pre > code.line-numbers:first-child").forEach(e)))})(); |
{ | ||
"name": "@xiee/utils", | ||
"version": "1.13.43", | ||
"version": "1.13.44", | ||
"description": "Miscellaneous tools and utilities to manipulate HTML pages", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -0,1 +1,4 @@ | ||
[![jsdelivr | ||
badge](https://data.jsdelivr.com/v1/package/npm/@xiee/utils/badge)](https://www.jsdelivr.com/package/npm/@xiee/utils) | ||
This repo contains miscellaneous tools and utilities written in JavaScript. They | ||
@@ -2,0 +5,0 @@ are published as an NPM package |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
223570
186
2532
187