From a889886d18725bab43ac5c79eb071e7dd87364b4 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Thu, 21 Jul 2022 21:44:53 +0200 Subject: [PATCH] load highlightingjs without inline --- assets/js/papermod.js | 6 +++++- layouts/partials/script.html | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/js/papermod.js b/assets/js/papermod.js index 641867c..c90a8e4 100644 --- a/assets/js/papermod.js +++ b/assets/js/papermod.js @@ -105,4 +105,8 @@ function showCodeCopyButtons() { initializeMenu(); if (params.scrollToTop) scrollToTop(); if (params.themeToggle) themeToggle(); -if (params.showCodeCopyButtons) showCodeCopyButtons(); \ No newline at end of file +if (params.showCodeCopyButtons) showCodeCopyButtons(); + +if ('hljs' in window) { + hljs.initHighlightingOnLoad(); +} \ No newline at end of file diff --git a/layouts/partials/script.html b/layouts/partials/script.html index bda3a1d..33becc1 100644 --- a/layouts/partials/script.html +++ b/layouts/partials/script.html @@ -18,11 +18,10 @@ {{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }} {{- if not site.Params.assets.disableFingerprinting }} {{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | fingerprint }} - + {{- else }} {{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" }} - + {{- end }} {{- end }}