diff options
author | Leonid Evdokimov <leon@darkk.net.ru> | 2018-01-28 21:46:50 +0300 |
---|---|---|
committer | Leonid Evdokimov <leon@darkk.net.ru> | 2018-01-28 21:46:50 +0300 |
commit | 594c8c1cc0cbcadfc1789ffda9f2aa3eae9a59c9 (patch) | |
tree | e7a9755779b8c3ac6e237e778a750706d43f0f99 | |
parent | a4803d7bb5257c82adb2b80b6033b6b175d78fad (diff) |
Make hljsTheme configurable, use dark theme for themeStyle=dark
-rw-r--r-- | exampleSite/config.toml | 3 | ||||
-rw-r--r-- | layouts/partials/header.html | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index fffbd03..2a8d61d 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -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 @@ -54,4 +55,4 @@ canonifyurls = true # Turns relative urls into a [[params.social]] url = "https://linkedin.com/" - icon = "linkedin"
\ No newline at end of file + icon = "linkedin" diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 89ca738..c775331 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -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 }} @@ -84,4 +90,4 @@ crossorigin="anonymous"></script> <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> {{ end }} -</head>
\ No newline at end of file +</head> |