summaryrefslogtreecommitdiffstats
path: root/markup/highlight
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-02-26 10:42:21 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-02-26 21:54:36 +0100
commit10928a4f781c2faf704825ef95234125812ad860 (patch)
tree6d53312b301ad5259eb509fbdd13efa6c5c199e5 /markup/highlight
parentafd63bf7d56194a6aa5d32483151d71fa0b84f3a (diff)
Remove the trailing new line in .Code
Fixes #9572
Diffstat (limited to 'markup/highlight')
-rw-r--r--markup/highlight/highlight.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/markup/highlight/highlight.go b/markup/highlight/highlight.go
index 6013ba1c8..156007d0a 100644
--- a/markup/highlight/highlight.go
+++ b/markup/highlight/highlight.go
@@ -25,6 +25,7 @@ import (
"github.com/alecthomas/chroma/lexers"
"github.com/alecthomas/chroma/styles"
"github.com/gohugoio/hugo/common/hugio"
+ "github.com/gohugoio/hugo/common/text"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/markup/converter/hooks"
"github.com/gohugoio/hugo/markup/internal/attributes"
@@ -123,7 +124,9 @@ func (h chromaHighlighter) RenderCodeblock(w hugio.FlexiWriter, ctx hooks.Codebl
return err
}
- return highlight(w, ctx.Code(), ctx.Lang(), attributes, cfg)
+ code := text.Puts(ctx.Code())
+
+ return highlight(w, code, ctx.Lang(), attributes, cfg)
}
var id = identity.NewPathIdentity("chroma", "highlight")