mirror of
https://github.com/gohugoio/hugo.git
synced 2025-05-03 17:10:11 +03:00
markup/goldmark/codeblock: Fix attributes when no language identifier in CodeBlock
Fixes #10118
This commit is contained in:
parent
3fefea06b8
commit
cbdaff2135
2 changed files with 42 additions and 2 deletions
|
@ -265,6 +265,39 @@ Position: {{ .Position | safeHTML }}
|
|||
b.AssertFileContent("public/p1/index.html", filepath.FromSlash("Position: \"/content/p1.md:7:1\""))
|
||||
}
|
||||
|
||||
// Issue 10118
|
||||
func TestAttributes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- config.toml --
|
||||
-- content/p1.md --
|
||||
---
|
||||
title: "p1"
|
||||
---
|
||||
|
||||
## Issue 10118
|
||||
|
||||
§§§ {foo="bar"}
|
||||
Hello, World!
|
||||
§§§
|
||||
|
||||
-- layouts/_default/single.html --
|
||||
{{ .Content }}
|
||||
-- layouts/_default/_markup/render-codeblock.html --
|
||||
Attributes: {{ .Attributes }}|Type: {{ .Type }}|
|
||||
`
|
||||
|
||||
b := hugolib.NewIntegrationTestBuilder(
|
||||
hugolib.IntegrationTestConfig{
|
||||
T: t,
|
||||
TxtarString: files,
|
||||
},
|
||||
).Build()
|
||||
|
||||
b.AssertFileContent("public/p1/index.html", "<h2 id=\"issue-10118\">Issue 10118</h2>\nAttributes: map[foo:bar]|Type: |")
|
||||
}
|
||||
|
||||
// Issue 9571
|
||||
func TestAttributesChroma(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue