hugo-stanley/layouts/partials/syntax.html

21 lines
723 B
HTML

{{- with site.Params.syntax -}}
{{- $use := "none" -}}
{{- if and (isset . "use") (ne .use "") -}}
{{- $use = .use | lower -}}
{{- end -}}
{{- $syntaxJS := "" -}}
{{- if eq $use "hljs" -}}
{{- $syntaxJS = "js/hljs.js" -}}
{{- else if eq $use "prismjs" -}}
{{- $syntaxJS = "js/prism.js" -}}
{{- end -}}
{{- if ne $syntaxJS "" -}}
{{- $js := resources.Get $syntaxJS | resources.Minify | resources.Fingerprint "sha384" -}}
<script src="{{- $js.RelPermalink -}}" integrity="{{- $js.Data.Integrity -}}"></script>
{{- if eq $use "hljs" -}}
<script>hljs.initHighlightingOnLoad();</script>
{{- end -}}
{{- end -}}
{{- end -}}