Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/puresyntax71/hugo-theme-chunky-poster.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpuresyntax71 <34715246+puresyntax71@users.noreply.github.com>2020-01-09 20:19:31 +0300
committerpuresyntax71 <34715246+puresyntax71@users.noreply.github.com>2020-01-09 20:19:31 +0300
commit26f5857d493439237091f055be5216494ee5a754 (patch)
tree3a42de3b8524275c6ad0261d79713324fc31d570
parent45b91bb604a022dc2a04aa2f5470a573df132be2 (diff)
Manually load prismJS.
-rw-r--r--layouts/partials/foot.html4
-rw-r--r--src/js/App.js6
2 files changed, 10 insertions, 0 deletions
diff --git a/layouts/partials/foot.html b/layouts/partials/foot.html
index 53592ed..1be0d20 100644
--- a/layouts/partials/foot.html
+++ b/layouts/partials/foot.html
@@ -7,6 +7,10 @@
{{ end }}
{{ if .Site.Params.prismJS.enable }}
+<script>
+ window.Prism = window.Prism || {};
+ window.Prism.manual = true;
+</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js"></script>
{{ end }}
diff --git a/src/js/App.js b/src/js/App.js
index 1954a16..84be072 100644
--- a/src/js/App.js
+++ b/src/js/App.js
@@ -102,6 +102,12 @@ export default {
});
},
syntaxHighlight: () => {
+ if (!window.Prism) {
+ return;
+ }
+
+ Prism.highlightAll();
+
$('pre:has(> code[class*=language-])').removeAttr('style');
const element = $('pre:has(> code:not([class*=language-]))');