Make hljsTheme configurable, use dark theme for themeStyle=dark

This commit is contained in:
Leonid Evdokimov 2018-01-28 21:46:50 +03:00
parent a4803d7bb5
commit 594c8c1cc0
2 changed files with 9 additions and 2 deletions

View file

@ -24,6 +24,7 @@ canonifyurls = true # Turns relative urls into a
description = "Website Description" # Max 160 characters show in search results
faviconFile = "img/fav.ico"
highlightjs = true # Syntax highlighting
hljsTheme = true # Select highlight.js theme: https://highlightjs.org/static/demo/
footerText = "" # Text to show in footer (overrides default text)
fadeIn = true # Turn on/off the fade-in effect

View file

@ -35,7 +35,13 @@
<!-- CSS -->
{{ if .Site.Params.highlightjs }}
{{ if .Site.Params.hljsTheme }}
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/{{ .Site.Params.hljsTheme }}.min.css">
{{ else if eq .Site.Params.themeStyle "light" }}
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css">
{{ else }}
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/tomorrow-night.min.css">
{{ end }}
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
{{ end }}