amethyst/quartz/js/code-title.ce4a43f09239a9efb48fee342e8ef2df.min.js

1 line
355 B
JavaScript

function addTitleToCodeBlocks(){const e=document.getElementsByClassName("highlight");for(let t=0;t<e.length;t++)try{if(e[t].title.length){let n=document.createElement("div");if(e[t].getElementsByClassName("code-title").length)continue;n.textContent=e[t].title,n.classList.add("code-title"),e[t].insertBefore(n,e[t].firstChild)}}catch(e){console.debug(e)}}