mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
markup: Goldmark log "Raw HTML omitted" warning also for inline HTML
Fixes #13013
This commit is contained in:
@@ -804,7 +804,7 @@ H~2~0
|
||||
}
|
||||
|
||||
// Issue 12997.
|
||||
func TestGoldmarkRawHTMLWarning(t *testing.T) {
|
||||
func TestGoldmarkRawHTMLWarningBlocks(t *testing.T) {
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
|
||||
@@ -827,3 +827,27 @@ title: "p1"
|
||||
b.AssertFileContent("public/p1/index.html", "! <!-- raw HTML omitted -->")
|
||||
b.AssertLogContains("! WARN")
|
||||
}
|
||||
|
||||
func TestGoldmarkRawHTMLWarningInline(t *testing.T) {
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
|
||||
markup.goldmark.renderer.unsafe = false
|
||||
-- content/p1.md --
|
||||
---
|
||||
title: "p1"
|
||||
---
|
||||
<em>raw HTML</em>
|
||||
-- layouts/_default/single.html --
|
||||
{{ .Content }}
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files, hugolib.TestOptWarn())
|
||||
|
||||
b.AssertFileContent("public/p1/index.html", "<!-- raw HTML omitted -->")
|
||||
b.AssertLogContains("WARN Raw HTML omitted from \"/content/p1.md\"; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe\nYou can suppress this warning by adding the following to your site configuration:\nignoreLogs = ['warning-goldmark-raw-html']")
|
||||
|
||||
b = hugolib.Test(t, strings.ReplaceAll(files, "markup.goldmark.renderer.unsafe = false", "markup.goldmark.renderer.unsafe = true"), hugolib.TestOptWarn())
|
||||
b.AssertFileContent("public/p1/index.html", "! <!-- raw HTML omitted -->")
|
||||
b.AssertLogContains("! WARN")
|
||||
}
|
||||
|
Reference in New Issue
Block a user