mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 06:44:07 -06:00
fix(code title): corrected accidental omission of code-title.js
This commit is contained in:
parent
d0902f382c
commit
7fd830f838
12
assets/js/code-title.js
Normal file
12
assets/js/code-title.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
function addTitleToCodeBlocks() {
|
||||||
|
var els = document.getElementsByClassName("highlight");
|
||||||
|
for (var i = 0; i < els.length; i++) {
|
||||||
|
if (els[i].title.length) {
|
||||||
|
let div = document.createElement("div");
|
||||||
|
div.textContent=els[i].title;
|
||||||
|
div.classList.add("code-title")
|
||||||
|
els[i].insertBefore(div, els[i].firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user