-
Notifications
You must be signed in to change notification settings - Fork 166
Description
Hey Maud folks! 👋
Just wanted to share a little Neovim formatter I whipped up for Maud templates! Since there's currently no dedicated formatter for Maud HTML, I thought other Maud + Neovim users might appreciate this.
The Problem
Working with Maud is awesome, but there's no built-in formatting solution. When writing complex templates, I found myself manually indenting everything, which gets tedious - especially with all those closing braces piling up at the end!
The Solution
I created a simple Neovim plugin called maud-fmt.nvim that makes Maud templates look pretty! It properly indents everything and aligns those closing braces to match their opening elements.
Before & After
Before (just a typical unformatted template):
html! {
div #main {
.content {
img src="image.png" {}
h1 { "Title" }
p.blurb { "Description" }
p.unsub { "Text" }
div .form {
input type="text" {}
button { "Submit" }
}
}
}
}After:
html! {
div #main {
.content {
img src="image.png" {}
h1 {
"Title"
}
p.blurb {
"Description"
}
p.unsub {
"Text"
}
div .form {
input type="text" {}
button {
"Submit"
}
}
}
}
}And voilà! You can format any Maud template with :MaudFormat or by pressing <leader>mf in normal mode.
Would be super cool to have this mentioned somewhere in your docs or wiki for all the Neovim users out there! Feel free to modify it or suggest improvements.
Keep up the amazing work on Maud! <3
Cheers!
Suggested labels: documentation, enhancement