Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fiatjaf/hyperscript-go
the simplest html generator you'll find in the goniverse
https://github.com/fiatjaf/hyperscript-go
hyperscript template-engine
Last synced: 20 days ago
JSON representation
the simplest html generator you'll find in the goniverse
- Host: GitHub
- URL: https://github.com/fiatjaf/hyperscript-go
- Owner: fiatjaf
- Created: 2016-09-21T01:17:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-27T01:39:19.000Z (over 8 years ago)
- Last Synced: 2024-11-10T01:17:18.822Z (2 months ago)
- Topics: hyperscript, template-engine
- Language: Go
- Size: 6.84 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## hyperscript-go
supersimple [hyperscript](https://github.com/dominictarr/hyperscript)-inspired templating language / html generator for go.
### usage
something like
```go
package mainimport (
"fmt"
"github.com/fiatjaf/hyperscript-go"
)func main() {
fmt.Print(h.Element("div#container", nil, h.HH{
h.Element("h1.title", nil, h.Text("hello stranger")),
h.Element(".nonsense", nil, h.HH{
h.Element("a", h.A{"href": "#"}, h.Text("click here to do nothing")),
h.HTML("or here"),
}),
}).Render())
}
```outputs `
`### be responsible
this library is very naïve and will fail if pushed to awkward situations. for example, when using special characters in attribute names and values.