Glavin001 / atom-beautify

:mega: Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | :lipstick: Universal beautification package for Atom editor (:warning: Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding :heart: )
http://unibeautify.com/
MIT License
1.49k stars 454 forks source link

Handlebars partial block causes weird indentation #2382

Open SonOfHans opened 5 years ago

SonOfHans commented 5 years ago

Description

Opening a partial block causes the beautifier to indent once (which is correct), but closing the block never unindents, which causes the remainder of the code to have extra indentation.

Input Before Beautification

This is what the code looked like before:

<div>
    Stuff
</div>

{{#>partialBlock}}
    <div>
        Inner portion
    </div>
{{/partialBlock}}

<div>
    More stuff
</div>

Expected Output

The beautified code should have looked the same.

Actual Output

The beautified code actually looked like this:

<div>
    Stuff
</div>

{{#>partialBlock}}
    <div>
        Inner portion
    </div>
    {{/partialBlock}}

    <div>
        More stuff
    </div>

Steps to Reproduce

  1. Add code to Atom editor
  2. Run command Atom Beautify: Beautify Editor
  3. This beautified code does not look right!

Debug

Here is a link to the debug.md Gist: https://gist.github.com/SonOfHans/42ae1754eb33807114f15690cc434461

Checklist

I have:

prettydiff commented 5 years ago

You are using the default HTML beautifier, JS Beautify. Switch to Pretty Diff and the issue is resolved.

SonOfHans commented 5 years ago

Thanks for the input. Though it's true that Pretty Diff doesn't have this particular issue, it actually has its own bug that outright breaks some of my pages and therefore makes it not a viable option for use with Handlebars.