From: Joe Mooring
\[!([a-zA-Z]+)\](-|\+)?[^\S\r\n]?([^\n]*)\n?`) func resolveBlockQuoteAlert(s string) blockQuoteAlert { - m := blockQuoteAlertRe.FindStringSubmatch(s) + m := blockQuoteAlertRe.FindStringSubmatch(strings.TrimSpace(s)) if len(m) == 4 { title := strings.TrimSpace(m[3]) title = strings.TrimSuffix(title, "
") diff --git a/markup/goldmark/blockquotes/blockquotes_integration_test.go b/markup/goldmark/blockquotes/blockquotes_integration_test.go index 6f7914d07..f9d308538 100644 --- a/markup/goldmark/blockquotes/blockquotes_integration_test.go +++ b/markup/goldmark/blockquotes/blockquotes_integration_test.go @@ -15,6 +15,7 @@ package blockquotes_test import ( "path/filepath" + "strings" "testing" "github.com/gohugoio/hugo/hugolib" @@ -76,7 +77,7 @@ title: "p1" "Blockquote Alert: |This is a note with some whitespace after the alert type.
|alert|", "Blockquote Alert: |This is a tip.
", "Blockquote Alert: |This is a caution with some whitespace before the alert type.
|alert|", - "Blockquote: |A regular blockquote.
|regular|", + "Blockquote: |A regular blockquote.
\n|regular|", "Blockquote Alert Attributes: |This is a tip with attributes.
|map[class:foo bar id:baz]|", filepath.FromSlash("/content/p1.md:19:3"), "Blockquote Alert Page: |This is a tip with attributes.
|p1|p1|", @@ -248,6 +249,37 @@ title: home "AlertType: fourteen|AlertTitle: title|Text:
line one
|", - "AlertType: |AlertTitle: |Text:seventeen
|", + "AlertType: |AlertTitle: |Text:seventeen
\n|", ) } + +// Issue14046 +func TestBlockquoteDefaultOutput(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['home','rss','section','sitemap','taxonomy','term'] +-- content/p1.md -- +--- +title: p1 +--- +> foo +-- layouts/page.html -- +|{{ .Content }}| +-- xxx -- ++{{ .Text }} ++` + + want := "|
\n\n|" + + b := hugolib.Test(t, files) + b.AssertFileContent("public/p1/index.html", want) // fail + + files = strings.ReplaceAll(files, "xxx", "layouts/_markup/render-blockquote.html") + + b = hugolib.Test(t, files) + b.AssertFileContent("public/p1/index.html", want) +}foo
\n