2018-07-29 21:41:49 +00:00
|
|
|
{{ if .Site.Params.highlightjs }}
|
2018-08-15 01:55:27 +00:00
|
|
|
{{ if or (not (isset .Params "highlight")) (.Params.highlight) }}
|
2018-09-22 23:46:34 +00:00
|
|
|
{{ .Scratch.Set "hl_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>
|
2018-09-22 23:46:34 +00:00
|
|
|
{{ with .Scratch.Get "hl_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">
|
2018-09-22 23:46:34 +00:00
|
|
|
{{ with .Scratch.Get "hl_languages" }}
|
|
|
|
hljs.configure({languages: [{{(delimit . ", ")}}]});
|
|
|
|
{{ end }}
|
2018-08-15 00:20:23 +00:00
|
|
|
hljs.initHighlightingOnLoad();
|
|
|
|
</script>
|
2018-09-22 23:46:34 +00:00
|
|
|
{{ .Scratch.Delete "hl_languages" }}
|
2018-08-15 00:20:23 +00:00
|
|
|
{{ end }}
|
2018-07-29 21:41:49 +00:00
|
|
|
{{ end }}
|