mirror of
https://github.com/Noettore/cocoa-eh-hugo-theme.git
synced 2025-10-15 11:46:41 +02:00
Support additional languages for highlight.js
highlight.min.js only includes 22 commonly used languages. E.g. Go and Rust are not part of that set. This change allows users to add the JS for additional languages via a config option. I've also updated the library to the newest version.
This commit is contained in:
@@ -28,6 +28,7 @@ faviconfile = "img/leaf.ico"
|
|||||||
gatracker = "XYZ"
|
gatracker = "XYZ"
|
||||||
github = "//github.com/you"
|
github = "//github.com/you"
|
||||||
highlightjs = true
|
highlightjs = true
|
||||||
|
# highlightjslanguages = ["go"] # additional languages not included in the "common" set
|
||||||
initials = "ad" # Displayed on single post page; DEPRECATED in v0.3.0.
|
initials = "ad" # Displayed on single post page; DEPRECATED in v0.3.0.
|
||||||
lang = "en"
|
lang = "en"
|
||||||
linkedin = "//linkedin.com/in/you"
|
linkedin = "//linkedin.com/in/you"
|
||||||
|
@@ -13,7 +13,10 @@ try {
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Site.Params.highlightjs }}
|
{{ if .Site.Params.highlightjs }}
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
|
||||||
|
{{ range .Site.Params.highlightjslanguages }}
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/languages/{{.}}.min.js"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
hljs.initHighlightingOnLoad();
|
hljs.initHighlightingOnLoad();
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
|
|
||||||
{{ if .Site.Params.highlightjs }}
|
{{ if .Site.Params.highlightjs }}
|
||||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css">
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/default.min.css">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user