between.js
Version:
Lightweight ES6 JavaScript tweening engine
9 lines (6 loc) • 345 B
JavaScript
const code = document.querySelector('[data-example-code]').innerText.split('\n');
code.shift();
const padding = code[0].match(/^(\s)*/g)[0].length;
document.querySelector('[data-example-hljs]').innerText = code.map(line => line.slice(padding)).join('\n');
for (let block of document.querySelectorAll('pre code'))
hljs.highlightBlock(block);