Writing a formatter has never been so easy: a Topiary tutorial
Yann Hamdaoui has written a step-by-step guide on how to write a new formatter for your own language, starting from zero.
Part 1
Part 1 introduces Topiary and motivates its use to create a formatter for a toy language, Yolo. Yann first guides you through the creation of a Tree-sitter grammar for Yolo, then plugs it into Topiary to write its formatting queries.
Part 2
Part 2 continues from where the previous part left off, by exploring some of the more advanced formatting features of Topiary, which are useful when handling real-life languages. In particular, it looks at single-line and multi-line layouts, using the Yolo toy language.