Merge pull request #117 from nekr0z/highlight-js
fix highlight-js partial
This commit is contained in:
commit
7570de8eb4
1 changed files with 4 additions and 4 deletions
|
@ -1,13 +1,12 @@
|
||||||
{{ if (isset .Params "highlight") }}
|
{{- if (.Site.Params.highlightjs) -}}
|
||||||
|
{{ if or (not (isset .Params "highlight")) (and (isset .Params "highlight") .Params.highlight) }}
|
||||||
{{ $.Scratch.Set "hl_languages" (union (.Site.Params.highlightjslanguages) (.Params.highlightjslanguages)) }}
|
{{ $.Scratch.Set "hl_languages" (union (.Site.Params.highlightjslanguages) (.Params.highlightjslanguages)) }}
|
||||||
{{ if (.Site.Params.highlightjs) }}
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
|
|
||||||
{{ with $.Scratch.Get "hl_languages" }}
|
{{ with $.Scratch.Get "hl_languages" }}
|
||||||
{{ range . }}
|
{{ range . }}
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/{{.}}.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/{{.}}.min.js"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{{ with $.Scratch.Get "hl_languages" }}
|
{{ with $.Scratch.Get "hl_languages" }}
|
||||||
hljs.configure({languages: [{{(delimit . ", ")}}]});
|
hljs.configure({languages: [{{(delimit . ", ")}}]});
|
||||||
|
@ -16,3 +15,4 @@
|
||||||
</script>
|
</script>
|
||||||
{{ $.Scratch.Delete "hl_languages" }}
|
{{ $.Scratch.Delete "hl_languages" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
Loading…
Reference in a new issue