Add Pygments configuration

Closes #61
This commit is contained in:
Bjørn Erik Pedersen 2017-07-20 08:30:52 +02:00
parent 572b9e7590
commit 8eef09d270
4 changed files with 15 additions and 4 deletions

View File

@ -16,6 +16,14 @@ pluralizeListTitles = false
# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below). # We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below).
disableAliases = true 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] [outputs]
home = [ "HTML", "RSS", "REDIR" ] home = [ "HTML", "RSS", "REDIR" ]
section = [ "HTML", "RSS"] section = [ "HTML", "RSS"]

View File

@ -1,5 +1,7 @@
<div class="code relative bg-primary-color moon-gray" id="{{.Get "file" | urlize}}"> {{ $file := .Get "file" }}
{{- with .Get "file" -}} {{ $isHTML := strings.HasSuffix $file "html" }}
<div class="code relative bg-primary-color" id="{{ $file | urlize}}">
{{- with $file -}}
<div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div> <div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div>
{{- end -}} {{- 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 */}} {{/* 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}} {{end}}
<div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}> <div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}>
{{- .Inner -}} {{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}
</div> </div>
</div> </div>

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Pygments==2.1.3

@ -1 +1 @@
Subproject commit 6ddf4d83cafd7fc6655e4623a6f5f90fe5bc1126 Subproject commit 29870cc895289e18cc5c1fcf99ce1d4f2a8b6ac6