Documentation menu
Getting Started
Core Concepts
Control
Interactivity
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.
To update the CLI, rerun
go install github.com/franchb/htmgo/cli/htmgo/v2@latest.Format Go files
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.goCopy
This will format the file specified.
Before formatting
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 formatting
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)