Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded image render hook does not honor markdown attributes #12203

Closed
jmooring opened this issue Mar 5, 2024 · 1 comment · Fixed by #12204
Closed

Embedded image render hook does not honor markdown attributes #12203

jmooring opened this issue Mar 5, 2024 · 1 comment · Fixed by #12204

Comments

@jmooring
Copy link
Member

jmooring commented Mar 5, 2024

Reference: https://discourse.gohugo.io/t/image-block-attribute-disappears-with-0-123-x/48677

Test case:

func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- config.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']

[markup.goldmark.parser]
wrapStandAloneImageWithinParagraph = false

[markup.goldmark.parser.attribute]
block = true

[languages.en]
# weight = 1
-- content/_index.md --
![alt](a.jpg)
{.foo}
-- layouts/index.html --
{{ .Content }}
`

	b := hugolib.Test(t, files)
	b.AssertFileContent("public/index.html", `<img src="a.jpg" alt="alt" class="foo">`)

	files = strings.Replace(files, "# weight", "weight", -1)

	b = hugolib.Test(t, files)
	b.AssertFileContent("public/index.html", `<img src="a.jpg" alt="alt" class="foo">`) // failing test
}
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants