fix(js): code block title for hugo 0.60 or above (#229)

Closes #221
This commit is contained in:
panda-z 2020-04-13 22:08:43 +08:00 committed by GitHub
parent e94d9b17e4
commit af108c4ad5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -171,7 +171,7 @@ Even.chroma = function() {
const blocks = document.querySelectorAll('.highlight > .chroma');
for (let i = 0; i < blocks.length; i++) {
const block = blocks[i];
const afterHighLight = block.querySelector('pre.chroma > code');
const afterHighLight = block.querySelector('pre.chroma > code[data-lang]');
const lang = afterHighLight ? afterHighLight.className : '';
block.className += ' ' + lang;
}