I guess it would be useful for programmatically building the DOM tree. But for writing DOM fragments, pug[1] is also an option. I happen to like the clean-looking syntax. Transposing their example:
body
h1 Hello World
input(type='range')
input(onclick='console.log') Log event
ul
li 1
li 2
li 3
unless false
span Hidden
[1] https://pugjs.org/api/getting-started.html