Skip to content

markup/goldmark: Blockquote default output is incorrect #14046

@jmooring

Description

@jmooring

This is a nit. I introduced the problem in #13122.

With this Markdown:

> foo

Without a code block render hook we should render this (match Goldmark/CommonMark):

<blockquote>
<p>foo</p>
</blockquote>

But we're rendering this instead:

<blockquote>
<p>foo</p></blockquote>

Found during creation of integration test for #14044.

integration test
// 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 --
<blockquote>
{{ .Text }}
</blockquote>
`

	want := "|<blockquote>\n<p>foo</p>\n</blockquote>\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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions