diff --git a/markup/goldmark/codeblocks/codeblocks_integration_test.go b/markup/goldmark/codeblocks/codeblocks_integration_test.go index c3808359d..faa079a81 100644 --- a/markup/goldmark/codeblocks/codeblocks_integration_test.go +++ b/markup/goldmark/codeblocks/codeblocks_integration_test.go @@ -147,6 +147,12 @@ title: "p1" fmt.Println("Hello, World!"); §§§ +## Plain Code + +§§§ +plain & text +§§§ + ` b := hugolib.Test(t, files) @@ -154,6 +160,8 @@ fmt.Println("Hello, World!"); b.AssertFileContent("public/p1/index.html", "Inner: |fmt.Println("Hello, World!");|", "Wrapped: |
fmt.Println("Hello, World!");
|", + "Inner: |plain <code> & text|", + "Wrapped: |
plain <code> & text
|", ) } diff --git a/markup/highlight/highlight.go b/markup/highlight/highlight.go index 8fe304254..bb58b9ca0 100644 --- a/markup/highlight/highlight.go +++ b/markup/highlight/highlight.go @@ -181,13 +181,14 @@ func highlight(fw hugio.FlexiWriter, code, lang string, attributes []attributes. if lexer == nil { if cfg.Hl_inline { fmt.Fprintf(w, "%s
", inlineCodeAttrs(lang), gohtml.EscapeString(code)) - } else { - preWrapper := getPreWrapper(lang, w) - fmt.Fprint(w, preWrapper.Start(true, "")) - fmt.Fprint(w, gohtml.EscapeString(code)) - fmt.Fprint(w, preWrapper.End(true)) + return 0, 0, nil } - return 0, 0, nil + + preWrapper := getPreWrapper(lang, w) + fmt.Fprint(w, preWrapper.Start(true, "")) + fmt.Fprint(w, gohtml.EscapeString(code)) + fmt.Fprint(w, preWrapper.End(true)) + return preWrapper.low, preWrapper.high, nil } style := styles.Get(cfg.Style)