Remove the trailing new line in .Code

Fixes #9572
This commit is contained in:
Bjørn Erik Pedersen
2022-02-26 10:42:21 +01:00
parent afd63bf7d5
commit 10928a4f78
7 changed files with 74 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ import (
"bytes"
"fmt"
htext "github.com/gohugoio/hugo/common/text"
"github.com/gohugoio/hugo/markup/converter/hooks"
"github.com/gohugoio/hugo/markup/goldmark/internal/render"
"github.com/gohugoio/hugo/markup/internal/attributes"
@@ -75,7 +76,8 @@ func (r *htmlRenderer) renderCodeBlock(w util.BufWriter, src []byte, node ast.No
line := n.b.Lines().At(i)
buff.Write(line.Value(src))
}
text := buff.String()
text := htext.Chomp(buff.String())
var info []byte
if n.b.Info != nil {