1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

Add PygmentsOptions option

This allows default pygments settings to be used, if none are explictly set per shortcode.

Fixes #1260
This commit is contained in:
Andrew Brampton
2015-07-08 18:51:54 -07:00
committed by Bjørn Erik Pedersen
parent 99acbb2eb2
commit c3931ef748
4 changed files with 101 additions and 38 deletions

View File

@@ -17,8 +17,9 @@ type HugoHtmlRenderer struct {
func (renderer *HugoHtmlRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {
if viper.GetBool("PygmentsCodeFences") {
opts := viper.GetString("PygmentsOptions")
str := html.UnescapeString(string(text))
out.WriteString(Highlight(str, lang, ""))
out.WriteString(Highlight(str, lang, opts))
} else {
renderer.Renderer.BlockCode(out, text, lang)
}