Open spruce opened 9 years ago
Some current Handlebars-issues: #576 #566 #577 #623 #1040 #1173 #1199
My thread seems to be a duplicate: https://github.com/beautify-web/js-beautify/issues/801
+1
+1 @rafaelcorreiapoli
+1 !!
Can I use js-beautify to format handlebars templates ?
+1
Is it possible to get some guidance in moving this along? Where should I look in the code to possibly start fixing some of these problems and get a PR working?
It's a little hard to nail down because the html beautifier doesn't parse the tags into tokens before formatting.
This is the main loop. There are some special treatment of some handlebars tags but most of them are treated like regular tags. Not great. https://github.com/beautify-web/js-beautify/blob/master/js/src/html/beautifier.js#L882
If you do a search for indent_handlebars
you'll find a bunch of other places with special cases for handlebars.
The best thing to do would be to get the html beautifier to parse all input separate from formatting, but that is a bigger effort.
Hey, I'm using your library in the sublime extension and was beginning to think whether there exists the possibility to add some custom parser for Handlebars? Because there are some specialities to using Handlebars (and in some time HTMLBars).
One example would be:
Should be formatted like this:
but the html-parser doesn't understand that syntax. That is understandable but I like that to change :)