hugo-theme-hyde-hyde/layouts/partials/highlight-js.html

19 lines
804 B
HTML
Raw Normal View History

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