Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 main

import (
"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 `


hello stranger



`

### 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.