From 5091bf6a0fcc33b1e9b0fe1ed67db3a17ea157d6 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 28 Jul 2023 11:50:05 -0700 Subject: [PATCH] Improve safeHTMLAttr explanation --- content/en/functions/safeHTMLAttr.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/content/en/functions/safeHTMLAttr.md b/content/en/functions/safeHTMLAttr.md index ac7f32d7a..bced1ba10 100644 --- a/content/en/functions/safeHTMLAttr.md +++ b/content/en/functions/safeHTMLAttr.md @@ -34,12 +34,16 @@ Will produce: `ZgotmplZ` is a special value, inserted by Go's [template/html] package, that indicates that unsafe content reached a CSS or URL context. -To override the safety check, use the `safeHTMLAttr` function: +To indicate that the HTML attribute is safe: ```go-html-template {{ range site.Menus.main }} {{ .Name }} {{ end }} -``` +``` + +{{% note %}} +As demonstrated above, you must pass the HTML attribute name _and_ value through the function. Applying `safeHTMLAttr` to the attribute value has no effect. +{{% /note %}} [template/html]: https://pkg.go.dev/html/template