hugo-theme-hyde-hyde/layouts/partials/highlight-js.html
Huy Tran 3b0d6601f5 Revert "replace to work with Hugo before 0.48 #40"
This reverts commit effb7d3e5f.

revert change
2018-09-23 09:50:31 +10:00

19 lines
889 B
HTML

{{ if .Site.Params.highlightjs }}
{{ if or (not (isset .Params "highlight")) (.Params.highlight) }}
{{ .Scratch.Set "hl_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 .Scratch.Get "hl_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">
{{ with .Scratch.Get "hl_languages" }}
hljs.configure({languages: [{{(delimit . ", ")}}]});
{{ end }}
hljs.initHighlightingOnLoad();
</script>
{{ .Scratch.Delete "hl_languages" }}
{{ end }}
{{ end }}