fmthtml is an HTML formatter (pretty-printer) for Go.
Example
package main
import (
"fmt"
"github.com/kjk/fmthtml"
)
func main() {
d := `<!DOCTYPE html><html><head><title>This is a title.</title></head><body>foo</body></html>`
d = fmthtml.Format([]byte(d))
fmt.Printf("%s\n", d)
}
Output:
<!DOCTYPE html>
<html>
<head>
<title>
This is a title.
</title>
</head>
<body>
foo
</body>
</html>