Skip to content

Commit

Permalink
markup/goldmark: Improve the raw HTML omitted warning
Browse files Browse the repository at this point in the history
Closes #13023
  • Loading branch information
jmooring authored and bep committed Nov 7, 2024
1 parent 35afe6f commit 2b97a2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions markup/goldmark/goldmark_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->")
Expand All @@ -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 -->")
Expand Down
2 changes: 1 addition & 1 deletion markup/goldmark/hugocontext/hugocontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2b97a2a

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy