Closed Robotxm closed 2 years ago
@Robotxm 请阅读 Argon 设置中 pjax 小节
感谢指导。研究了一下把 Enlighter 的 JS 加载在 pjaxLoaded
里再写一遍就好
<script>
window.pjaxLoaded = function() {
!function(e,n){if("undefined"!=typeof EnlighterJS){var o={"selectors":{"block":"pre.EnlighterJSRAW","inline":"code.EnlighterJSRAW"},"options":{"indent":4,"ampersandCleanup":true,"linehover":true,"rawcodeDbclick":false,"textOverflow":"scroll","linenumbers":true,"theme":"wpcustom","language":"generic","retainCssClasses":false,"collapse":false,"toolbarOuter":"","toolbarTop":"{BTN_RAW}{BTN_COPY}{BTN_WINDOW}{BTN_WEBSITE}","toolbarBottom":""}};(e.EnlighterJSINIT=function(){EnlighterJS.init(o.selectors.block,o.selectors.inline,o.options)})()}else{(n&&(n.error||n.log)||function(){})("Error: EnlighterJS resources not loaded yet!")}}(window,console);
}
</script>
WordPress 5.8.2,已经按照后台提示设置了如下选项
但每次从博客首页点进文章的时候,不会生效 Enlighter 的代码高亮。必须刷新页面才能加载出来 Enlighter 的代码块。