diff options
Diffstat (limited to 'markup/goldmark/integration_test.go')
-rw-r--r-- | markup/goldmark/integration_test.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/markup/goldmark/integration_test.go b/markup/goldmark/integration_test.go index d8f218b31..cab85cfdd 100644 --- a/markup/goldmark/integration_test.go +++ b/markup/goldmark/integration_test.go @@ -18,6 +18,8 @@ import ( "strings" "testing" + qt "github.com/frankban/quicktest" + "github.com/gohugoio/hugo/hugolib" ) @@ -395,6 +397,49 @@ FENCE } } +// Iisse #8959 +func TestHookInfiniteRecursion(t *testing.T) { + t.Parallel() + + for _, renderFunc := range []string{"markdownify", ".Page.RenderString"} { + t.Run(renderFunc, func(t *testing.T) { + + files := ` +-- config.toml -- +-- layouts/_default/_markup/render-link.html -- +<a href="{{ .Destination | safeURL }}">{{ .Text | RENDERFUNC }}</a> +-- layouts/_default/single.html -- +{{ .Content }} +-- content/p1.md -- +--- +title: "p1" +--- + +https://example.org + +a@b.com + + + ` + + files = strings.ReplaceAll(files, "RENDERFUNC", renderFunc) + + b, err := hugolib.NewIntegrationTestBuilder( + hugolib.IntegrationTestConfig{ + T: t, + TxtarString: files, + }, + ).BuildE() + + b.Assert(err, qt.IsNotNil) + b.Assert(err.Error(), qt.Contains, "text is already rendered, repeating it may cause infinite recursion") + + }) + + } + +} + // Issue 9594 func TestQuotesInImgAltAttr(t *testing.T) { t.Parallel() |