mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feat: 修改 toc 打開效果
feat: 適配 hexo-blog-encrypt fix: 修復 hexo 新版本下,prismjs 的問題 improvement: 在 pjax 關閉的情況下。減少不必要的全局變量 improvement: 更新依賴版本 improvement: 頁面進入效果優化 improvement: 添加平滑滾動 improvement: 兼容性優化 improvement: 優化 lighthouse 分數 improvement: 優化代碼
This commit is contained in:
28
layout/includes/third-party/prismjs.pug
vendored
28
layout/includes/third-party/prismjs.pug
vendored
@@ -1,5 +1,23 @@
|
||||
if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess
|
||||
script(src=url_for(theme.asset.prismjs_js))
|
||||
script(src=url_for(theme.asset.prismjs_autoloader))
|
||||
if config.prismjs.line_number
|
||||
script(src=url_for(theme.asset.prismjs_lineNumber_js))
|
||||
- const { prismjs_js, prismjs_autoloader, prismjs_lineNumber_js } = theme.asset
|
||||
- const { prismjs, syntax_highlighter } = config
|
||||
- const { enable, preprocess, line_number } = prismjs
|
||||
|
||||
if (syntax_highlighter === 'prismjs' || enable) && !preprocess
|
||||
script.
|
||||
(() => {
|
||||
window.Prism = window.Prism || {}
|
||||
window.Prism.manual = true
|
||||
|
||||
const highlightAll = () => {
|
||||
window.Prism.highlightAll()
|
||||
}
|
||||
|
||||
window.addEventListener('load', highlightAll)
|
||||
btf.addGlobalFn('pjaxComplete', highlightAll, 'prismjs')
|
||||
btf.addGlobalFn('encrypt', highlightAll, 'prismjs')
|
||||
})()
|
||||
|
||||
script(src=url_for(prismjs_js))
|
||||
script(src=url_for(prismjs_autoloader))
|
||||
if (line_number)
|
||||
script(src=url_for(prismjs_lineNumber_js))
|
||||
Reference in New Issue
Block a user