migrate syntax highlight to js bundle

This commit is contained in:
Aaron Qian 2022-11-11 14:33:38 -08:00 committed by Aaron Qian
parent 55c400075c
commit fbafe4f671
No known key found for this signature in database
GPG key ID: BF1A987C395B5B0E
6 changed files with 10 additions and 13 deletions

View file

@ -13,3 +13,7 @@ if (process.env.FEATURE_DARKMODE) {
if (process.env.FEATURE_FLOWCHART) {
import('./flowchart');
}
if (process.env.FEATURE_SYNTAXHIGHLIGHT) {
import('./syntaxhighlight');
}

View file

@ -0,0 +1,3 @@
import hljs from 'highlight.js';
hljs.highlightAll();

View file

@ -0,0 +1,3 @@
if (process.env.FEATURE_SYNTAXHIGHLIGHT_HLJS) {
import('./hljs');
}

View file

@ -192,11 +192,6 @@
{{ end }}
{{ define "scripts" }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
<!-------------- Enable Math support for this page ---------------->
{{ if .Params.math }}
{{ partial "math.html" . }}

View file

@ -57,10 +57,6 @@
{{ end }}
{{ define "scripts" }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
{{ if .Params.math }}
{{ partial "math.html" . }}
{{ end }}

View file

@ -47,10 +47,6 @@
{{ end }}
{{ define "scripts" }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
<script>
hljs.initHighlightingOnLoad();
</script>
{{ if .Params.math }}
{{ partial "math.html" . }}
{{ end }}