1
0
Fork 0
mirror of https://github.com/imjasonh/html synced 2026-07-08 08:56:07 +00:00
html/README.md
Jason Hall 01c7432c71 Initial commit
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 13:08:43 -05:00

29 lines
688 B
Markdown

# html
Type-safe HTML generation for Go, generated from WebIDL.
## Usage
```go
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](https://html.spec.whatwg.org/) 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
```bash
go run cmd/generate/main.go # Fetches latest WebIDL and regenerates elements
```