From 10928a4f781c2faf704825ef95234125812ad860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 26 Feb 2022 10:42:21 +0100 Subject: Remove the trailing new line in .Code Fixes #9572 --- markup/highlight/highlight.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'markup/highlight') 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") -- cgit v1.2.3