diff --git a/changelog_unreleased/handlebars/13507.md b/changelog_unreleased/handlebars/13507.md new file mode 100644 index 000000000000..c1246a28cf88 --- /dev/null +++ b/changelog_unreleased/handlebars/13507.md @@ -0,0 +1,33 @@ +#### [handlebars] correctly format custom "else if" blocks (#13507 by @jamescdavis) + +A template transform can be used to create custom block keywords that behave similar to `if`. This updates printer-glimmer to correctly recognize and format the "else if" case when "if" is a custom keyword. + + +```hbs +{{! Input }} +{{#when isAtWork}} + Ship that code! +{{else when isReading}} + You can finish War and Peace eventually... +{{else}} + Go to bed! +{{/when}} + +{{! Prettier stable }} +{{#when isAtWork}} + Ship that code! +{{else}}{{#when isReading}} + You can finish War and Peace eventually... + {{else}} + Go to bed! + {{/when}}{{/when}} + +{{! Prettier main }} +{{#when isAtWork}} + Ship that code! +{{else when isReading}} + You can finish War and Peace eventually... +{{else}} + Go to bed! +{{/when}} +```