mirror of
https://github.com/imjasonh/html
synced 2026-07-08 00:46:08 +00:00
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
688 B
688 B
html
Type-safe HTML generation for Go, generated from WebIDL.
Usage
import . "github.com/imjasonh/html"
page := Div(
P(Raw("Hello, "), T(username), Raw("!")),
A(Raw("Click here")).Href("/home"),
Img().Src("/logo.png").Alt("Logo"),
).Render()
Features
- Generated from WHATWG HTML Standard WebIDL
- Type-safe attributes (bool, int, string)
- XSS protection:
T()escapes user input,Raw()for trusted HTML Attr(key, value)escape hatch for arbitrary attributes- Automatic HTML escaping of attribute values
Generating
go run cmd/generate/main.go # Fetches latest WebIDL and regenerates elements