Repository: gohugoio/hugo (language: go)

Issue:
Improve the "raw HTML omitted" warning message
Change this:

```text
Raw HTML omitted from "/home/user/project/content/example.md"
```

To this:

```text
Raw HTML omitted while rendering "/home/user/project/content/example.md"
```

We should change the message because `markdownify` and `.Page.RenderString` can also trigger this warning, and it may have nothing to do with anything in the content file.

Reference: <https://discourse.gohugo.io/t/52280/6>



Discussion / hints:

Fix patch:
diff --git a/markup/goldmark/hugocontext/hugocontext.go b/markup/goldmark/hugocontext/hugocontext.go
index a10e095efb9..4098392c497 100644
--- a/markup/goldmark/hugocontext/hugocontext.go
+++ b/markup/goldmark/hugocontext/hugocontext.go
@@ -157,7 +157,7 @@ func (r *hugoContextRenderer) stripHugoCtx(b []byte) ([]byte, bool) {
 }
 
 func (r *hugoContextRenderer) logRawHTMLEmittedWarn(w util.BufWriter) {
-	r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted from %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", r.getPage(w))
+	r.logger.Warnidf(constants.WarnGoldmarkRawHTML, "Raw HTML omitted white rendering %q; see https://gohugo.io/getting-started/configuration-markup/#rendererunsafe", r.getPage(w))
 }
 
 func (r *hugoContextRenderer) getPage(w util.BufWriter) any {


Test patch:
diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go
index 82579069bb2..17b76360db0 100644
--- a/markup/goldmark/goldmark_integration_test.go
+++ b/markup/goldmark/goldmark_integration_test.go
@@ -821,7 +821,7 @@ title: "p1"
 	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.AssertLogContains("WARN  Raw HTML omitted white rendering \"/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 -->")
@@ -845,7 +845,7 @@ title: "p1"
 	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.AssertLogContains("WARN  Raw HTML omitted white rendering \"/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 -->")