feat(author): add author_link and fix highlight bug

This commit is contained in:
Dillon
2020-02-01 01:52:27 +08:00
parent 2a7611b5ae
commit 8aa4b6dce6
22 changed files with 136 additions and 110 deletions

View File

@@ -73,12 +73,13 @@ jQuery(function($) {
});
};
_Blog.chroma = function() {
_Blog.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 lang = afterHighLight ? afterHighLight.className : '';
const codes = block.querySelectorAll('pre.chroma > code');
const code = codes[codes.length - 1];
const lang = code ? code.className.toLowerCase() : '';
block.className += ' ' + lang;
}
};
@@ -298,4 +299,4 @@ jQuery(function($) {
_Blog.typeit();
_Blog.toc();
});
});
});