refactor: General performance/style improvements (#262)
parent
dc43737896
commit
614a6222a1
@ -1,13 +1,17 @@
|
|||||||
|
|
||||||
function addTitleToCodeBlocks() {
|
function addTitleToCodeBlocks() {
|
||||||
var els = document.getElementsByClassName("highlight");
|
const els = document.getElementsByClassName("highlight");
|
||||||
for (var i = 0; i < els.length; i++) {
|
for (let i = 0; i < els.length; i++) {
|
||||||
|
try {
|
||||||
if (els[i].title.length) {
|
if (els[i].title.length) {
|
||||||
let div = document.createElement("div");
|
let div = document.createElement("div");
|
||||||
if (els[i].getElementsByClassName("code-title").length) continue;
|
if (els[i].getElementsByClassName("code-title").length) continue;
|
||||||
div.textContent=els[i].title;
|
div.textContent = els[i].title;
|
||||||
div.classList.add("code-title")
|
div.classList.add("code-title")
|
||||||
els[i].insertBefore(div, els[i].firstChild);
|
els[i].insertBefore(div, els[i].firstChild);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.debug(error);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
{{if $.Site.Data.config.enableLatex}}
|
{{if $.Site.Data.config.enableLatex}}
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
|
<link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" as="style"
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
|
onload="this.onload=null;this.rel='stylesheet'"
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"></script>
|
integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/copy-tex.min.js" integrity="sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A" crossorigin="anonymous"></script>
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js"
|
||||||
|
integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js"
|
||||||
|
integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/copy-tex.min.js"
|
||||||
|
integrity="sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
{{end}}
|
{{end}}
|
Loading…
Reference in New Issue