summaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-01-23 09:48:04 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-01-23 09:48:04 +0100
commitebdd8cba3f5965a8ac897833f313d772271de649 (patch)
tree8211d5da5db836300b8892dbb984d7e51f43a730 /helpers
parent8125b4b03d10eb73f8aea3f9ea41172aba8df082 (diff)
helpers: Avoid unescape in highlight
Fixes #4219
Diffstat (limited to 'helpers')
-rw-r--r--helpers/content_renderer.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/helpers/content_renderer.go b/helpers/content_renderer.go
index 9026a683b..dc22cb6f4 100644
--- a/helpers/content_renderer.go
+++ b/helpers/content_renderer.go
@@ -15,7 +15,6 @@ package helpers
import (
"bytes"
- "html"
"strings"
"github.com/gohugoio/hugo/config"
@@ -36,7 +35,7 @@ type HugoHTMLRenderer struct {
func (r *HugoHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {
if r.Cfg.GetBool("pygmentsCodeFences") && (lang != "" || r.Cfg.GetBool("pygmentsCodeFencesGuessSyntax")) {
opts := r.Cfg.GetString("pygmentsOptions")
- str := strings.Trim(html.UnescapeString(string(text)), "\n\r")
+ str := strings.Trim(string(text), "\n\r")
highlighted, _ := r.cs.Highlight(str, lang, opts)
out.WriteString(highlighted)
} else {
@@ -100,7 +99,7 @@ type HugoMmarkHTMLRenderer struct {
// Pygments is used if it is setup to handle code fences.
func (r *HugoMmarkHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string, caption []byte, subfigure bool, callouts bool) {
if r.Cfg.GetBool("pygmentsCodeFences") && (lang != "" || r.Cfg.GetBool("pygmentsCodeFencesGuessSyntax")) {
- str := strings.Trim(html.UnescapeString(string(text)), "\n\r")
+ str := strings.Trim(string(text), "\n\r")
highlighted, _ := r.cs.Highlight(str, lang, "")
out.WriteString(highlighted)
} else {