Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xiaoheiAh/hugo-theme-pure.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryx.z <xiaohei.zyx@gmail.com>2019-12-24 15:33:20 +0300
committerGitHub <noreply@github.com>2019-12-24 15:33:20 +0300
commit033a377ef93c8b3d0ee2852d1f01ee64c2686cff (patch)
tree14de3e2514eae311addfaeb72147bc043a6d3397
parentd3bcd1ba57301a12730aec3d4a6e81fe7210b5a2 (diff)
parent523d54bb0f0b37dd3edc5e0a964c594fe7b324d2 (diff)
Merge pull request #39 from udit-001/highlight-js-patch
Allows authors to choose highlight languages.
-rw-r--r--exampleSite/config.yml3
-rw-r--r--layouts/partials/script.html6
2 files changed, 6 insertions, 3 deletions
diff --git a/exampleSite/config.yml b/exampleSite/config.yml
index 05f932f..8ec2ba8 100644
--- a/exampleSite/config.yml
+++ b/exampleSite/config.yml
@@ -71,6 +71,9 @@ params:
# Enable/Disable menu icons
# Icon Reference: http://blog.cofess.com/hexo-theme-pure/iconfont/demo_fontclass.html
enableMathJax: true #Enable mathjax support, to use mathematical notations
+ highlightjs:
+ langs: ["python", "javascript"] #specify languages for which you want to add syntax highlight support
+
menuIcons:
enable: true # 是否启用导航菜单图标
home: icon-home-fill
diff --git a/layouts/partials/script.html b/layouts/partials/script.html
index b18a56c..9ff925c 100644
--- a/layouts/partials/script.html
+++ b/layouts/partials/script.html
@@ -6,9 +6,9 @@
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js"></script>
-<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/rust.min.js"></script>
-<script type="text/javascript"
- src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/dockerfile.min.js"></script>
+{{- range .Site.Params.highlightjs.langs }}
+<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/{{.}}.min.js"></script>
+{{- end -}}
<script>
hljs.configure({
tabReplace: ' ', // 4 spaces