better fix for #27
This commit is contained in:
parent
9cf91340bc
commit
e23b920241
1 changed files with 15 additions and 12 deletions
|
@ -1,15 +1,18 @@
|
|||
{{ if .Site.Params.highlightjs }}
|
||||
{{ $hl := newScratch }}
|
||||
{{ $hl.Set "languages" .Site.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>
|
||||
{{ if or (not (isset .Params "highlight")) (not .Params.highlight) }}
|
||||
{{ $hl := newScratch }}
|
||||
{{ $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 }}
|
||||
{{ end }}
|
||||
<script type="text/javascript">
|
||||
hljs.configure({languages: []});
|
||||
hljs.initHighlightingOnLoad();
|
||||
</script>
|
||||
{{ $hl.Delete "languages" }}
|
||||
<script type="text/javascript">
|
||||
hljs.configure({languages: []});
|
||||
hljs.initHighlightingOnLoad();
|
||||
</script>
|
||||
{{ $hl.Delete "languages" }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue