-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape attributes before printing #1
Comments
Ah, you're right. Thanks! Unfortunately, I don't think it's as simple as just re-escaping the One use case is to unminify HTML created by a templating engine, so that we can compare it to expected output, and have an easy to visualise result. Part of that use case is to find issues like invalid escaping, so fixing the invalid input isn't what we want. One option is to fork the HTML parser and make the change to add the raw attribute value to the Node type, and then use it. There's only about 1 commit a month to the parser, so it probably wouldn't be too much of a maintenance burden. https://github.com/golang/net/commits/master/html |
Actually getting the "value as interpreted by the browser" should be enough (which is what Alternatively, you could reconstruct an |
Thanks, agreed. I've fixed this in 5bd994f |
As noticed in a-h/templ#284
a.Val
must be escaped usinghtml.EscapeString
in at least two places:htmlformat/format.go
Line 63 in c3d4a33
htmlformat/format.go
Line 133 in c3d4a33
The text was updated successfully, but these errors were encountered: