diff options
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/transform/transform.go | 2 | ||||
-rw-r--r-- | tpl/transform/transform_test.go | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tpl/transform/transform.go b/tpl/transform/transform.go index a94cc46e2..7ec1fec02 100644 --- a/tpl/transform/transform.go +++ b/tpl/transform/transform.go @@ -55,7 +55,7 @@ func (ns *Namespace) Highlight(s interface{}, lang, opts string) (template.HTML, return "", err } - highlighted, _ := ns.deps.ContentSpec.Highlight(html.UnescapeString(ss), lang, opts) + highlighted, _ := ns.deps.ContentSpec.Highlight(ss, lang, opts) return template.HTML(highlighted), nil } diff --git a/tpl/transform/transform_test.go b/tpl/transform/transform_test.go index 429b206fd..195a0f15c 100644 --- a/tpl/transform/transform_test.go +++ b/tpl/transform/transform_test.go @@ -69,6 +69,8 @@ func TestHighlight(t *testing.T) { expect interface{} }{ {"func boo() {}", "go", "", "boo"}, + // Issue #4179 + {`<Foo attr=" < "></Foo>`, "xml", "", `&lt;`}, {tstNoStringer{}, "go", "", false}, } { errMsg := fmt.Sprintf("[%d]", i) @@ -81,7 +83,7 @@ func TestHighlight(t *testing.T) { } require.NoError(t, err, errMsg) - assert.Contains(t, result, "boo", errMsg) + assert.Contains(t, result, test.expect.(string), errMsg) } } |