1
0
Fork 0
mirror of https://github.com/imjasonh/html synced 2026-07-08 00:46:08 +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

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