diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-04-25 10:05:55 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-04-27 23:53:56 +0200 |
commit | d7b54a4c37c39fce60c25a745bae1d5987b2b966 (patch) | |
tree | 1ab9d0438063c0bd45ee62d45fa67b3cd4c4536a /markup/goldmark/codeblocks | |
parent | 13ceef7599fe84ec210adc98b90884ae3ab2881f (diff) |
markup/goldmark: Fix attribute nilpointer
Fixes 9819
Diffstat (limited to 'markup/goldmark/codeblocks')
-rw-r--r-- | markup/goldmark/codeblocks/integration_test.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/markup/goldmark/codeblocks/integration_test.go b/markup/goldmark/codeblocks/integration_test.go index 63b841e72..199049789 100644 --- a/markup/goldmark/codeblocks/integration_test.go +++ b/markup/goldmark/codeblocks/integration_test.go @@ -302,3 +302,51 @@ Attributes: {{ .Attributes }}|Options: {{ .Options }}| testLanguage("bash", "Attributes: map[]|Options: map[style:monokai]|") testLanguage("hugo", "Attributes: map[style:monokai]|Options: map[]|") } + +func TestPanics(t *testing.T) { + + files := ` +-- config.toml -- +[markup] +[markup.goldmark] +[markup.goldmark.parser] +autoHeadingID = true +autoHeadingIDType = "github" +[markup.goldmark.parser.attribute] +block = true +title = true +-- content/p1.md -- +--- +title: "p1" +--- + +BLOCK + +Common + +-- layouts/_default/single.html -- +{{ .Content }} + + +` + + for _, test := range []struct { + name string + markdown string + }{ + {"issue-9819", "asdf\n: {#myid}"}, + } { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + b := hugolib.NewIntegrationTestBuilder( + hugolib.IntegrationTestConfig{ + T: t, + TxtarString: strings.ReplaceAll(files, "BLOCK", test.markdown), + }, + ).Build() + + b.AssertFileContent("public/p1/index.html", "Common") + }) + } + +} |