Getting Started
Core Concepts
Control
Interactivity
Performance
Pushing Data
HTMX Extensions
Miscellaneous
Configuration
Formatter
htmgo has a built-in formatter that can be used to format htmgo element blocks.
It is available through the 'htmgo' cli tool that is installed with htmgo.
Note: if you have previously installed htmgo, you will need to run GOPROXY=direct go install github.com/maddalax/htmgo/cli/htmgo@latest to update the cli tool.
Usage:
htmgo format .
htmgo format .
Copy
This will format all htmgo element blocks in your project recursively.
htmgo format ./my-file.go
htmgo format ./my-file.go
Copy
This will format the file specified.
Before:
h.Div(
h.Class("flex gap-2"), h.Text("hello"), h.Text("world"),
)
Copy
1h.Div(
2 h.Class("flex gap-2"), h.Text("hello"), h.Text("world"),
3)
After:
h.Div(
h.Class("flex gap-2"),
h.Text("hello"),
h.Text("world"),
)
Copy
1h.Div(
2 h.Class("flex gap-2"),
3 h.Text("hello"),
4 h.Text("world"),
5)