优化单页打印

This commit is contained in:
Minho
2018-06-06 22:40:12 +08:00
parent 152d71a5a0
commit b18147f32c
3 changed files with 15 additions and 19 deletions

View File

@@ -72,14 +72,17 @@ function loadDocument($url, $id, $callback) {
* 初始化代码高亮
*/
function initHighlighting() {
$('pre,pre.ql-syntax').each(function (i, block) {
if($(this).hasClass('prettyprinted')){
return;
}
hljs.highlightBlock(block);
});
hljs.initLineNumbersOnLoad();
try {
$('pre,pre.ql-syntax').each(function (i, block) {
if ($(this).hasClass('prettyprinted')) {
return;
}
hljs.highlightBlock(block);
});
hljs.initLineNumbersOnLoad();
}catch (e){
console.log(e);
}
}