diff --git a/config.toml b/config.toml index 931ad9c25..08c72176f 100644 --- a/config.toml +++ b/config.toml @@ -16,6 +16,14 @@ pluralizeListTitles = false # We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below). disableAliases = true + +# Highlighting config (Pygments) +# It is (currently) not in use, but you can do ```go in a content file if you want to. +pygmentsCodeFences = true + +# See https://help.farbox.com/pygments.html +pygmentsStyle = "friendly" + [outputs] home = [ "HTML", "RSS", "REDIR" ] section = [ "HTML", "RSS"] diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html index 6df49956a..009aeb711 100644 --- a/layouts/shortcodes/code.html +++ b/layouts/shortcodes/code.html @@ -1,5 +1,7 @@ -
- {{- with .Get "file" -}} +{{ $file := .Get "file" }} +{{ $isHTML := strings.HasSuffix $file "html" }} +
+ {{- with $file -}}
{{.}}
{{- end -}} @@ -9,7 +11,7 @@ {{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}} {{end}}
- {{- .Inner -}} + {{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}
{{- .Inner | string -}}
{{ end }}
diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..e0f2f62df --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Pygments==2.1.3 diff --git a/themes/gohugoioTheme b/themes/gohugoioTheme index 6ddf4d83c..29870cc89 160000 --- a/themes/gohugoioTheme +++ b/themes/gohugoioTheme @@ -1 +1 @@ -Subproject commit 6ddf4d83cafd7fc6655e4623a6f5f90fe5bc1126 +Subproject commit 29870cc895289e18cc5c1fcf99ce1d4f2a8b6ac6