better fix for #27

This commit is contained in:
Huy Tran 2018-08-15 07:20:23 +07:00
parent 9cf91340bc
commit e23b920241

View file

@ -1,15 +1,18 @@
{{ if .Site.Params.highlightjs }}
{{ if or (not (isset .Params "highlight")) (not .Params.highlight) }}
{{ $hl := newScratch }}
{{ $hl.Set "languages" .Site.Params.highlightjslanguages }}
{{ $hl.Set "languages" (union (.Site.Params.highlightjslanguages) (.Params.highlightjslanguages)) }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ with $hl.Get "languages" }}
{{ range . }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/{{.}}.min.js"></script>
{{ end }}
{{ end }}
<script type="text/javascript">
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
</script>
{{ $hl.Delete "languages" }}
{{ end }}
{{ end }}