feat: 適配 hexo 5.0.0 的 prismjs, 代碼主題和各項功能

refactor: 移除 代碼default主題
fix: 修復夜間模式下代碼塊有背景的bugs(沒開啟渲染的情況下)
feat: 增加 code font-size配置 close #322
refactor: 更改配置中 code-font 為 code-font-family
feat: Pjax下,刷新頁面時,會滾動到上次瀏覽的位置
fix: 修復mathjax溢出屏幕的Bugs close #321
This commit is contained in:
Jerry
2020-08-19 00:21:18 +08:00
Unverified
parent 973306898a
commit 543cd94c9f
15 changed files with 557 additions and 183 deletions

View File

@@ -46,6 +46,8 @@ div
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
!=partial('includes/third-party/prismjs', {}, {cache:theme.fragment_cache})
!=partial('includes/third-party/effect', {}, {cache:theme.fragment_cache})
!=partial('includes/third-party/chat/index', {}, {cache:theme.fragment_cache})

View File

@@ -28,7 +28,15 @@ script.
math.end = {node: text, delim: '', n: 0}
doc.math.push(math)
}
}, '']
}, ''],
addClass: [200,() => {
document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
const target = node.parentNode
if (!target.classList.contains('has-jax')) {
target.classList.add('mathjax-overflow')
}
})
}, '', false]
}
}
}

View File

@@ -23,6 +23,8 @@ script.
elements: '!{pjaxExclude}',
selectors: pjaxSelectors,
cacheBust: false,
analytics: !{theme.google_analytics ? true : false},
scrollRestoration: false
})
document.addEventListener('pjax:complete', function () {
@@ -47,6 +49,9 @@ script.
if (!{theme.tencent_analytics ? true : false}) {
MtaH5.pgv()
}
// prismjs
typeof Prism === 'object' && Prism.highlightAll()
})
@@ -65,5 +70,6 @@ script.
//reset readmode
$('body').hasClass('read-mode') && $('body').removeClass('read-mode')
})

View File

@@ -0,0 +1,5 @@
if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess
script(src=url_for(theme.CDN.prismjs_js))
script(src=url_for(theme.CDN.prismjs_autoloader))
if config.prismjs.line_number
script(src=url_for(theme.CDN.prismjs_lineNumber_js))