hugo-stanley/layouts/partials/syntax.html

21 lines
723 B
HTML
Raw Permalink Normal View History

2020-03-03 18:56:59 +01:00
{{- 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 -}}