Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html beautify removes spaces #36

Closed
sander76 opened this issue Dec 13, 2013 · 4 comments
Closed

html beautify removes spaces #36

sander76 opened this issue Dec 13, 2013 · 4 comments

Comments

@sander76
Copy link

<strong>testing </strong> (mind the space after testing)

results in 
<strong>testing</strong> after beautify...

I guess this shouldn't be happening....
@sander76 sander76 reopened this Dec 13, 2013
@sander76
Copy link
Author

Or should it ?

@drewhamlett
Copy link
Member

Hey man, thanks for interest in this project. If you could please file an issue with https://github.com/einars/js-beautify . They are the ones who maintain the html/js/css formatter that this extension uses. I have noticed this but have lived with it for a while. They are very responsive and if you file an issue they'll tell you if it's in scope/possible/willing to do it. Thanks!

@numediaweb
Copy link

@drewhjava I think a newer version of beautify-html.js is needed to fix this bug; if you test the above code in the online version http://jsbeautifier.org/, you should get a valid result. So what I did is copied http://jsbeautifier.org/js/lib/beautify-html.js to Brackets Brackets\extensions\user\brackets-beautify plugin folder.
Please merge that file inside this extension.

@drewhamlett
Copy link
Member

Hey guys this has to do with default unformatted settings. By default I've opted in to format every tag. In the actual html beautify code this is the unformatted array.

['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']

If you would like, you can replace the unformatted array with this one for the time being. I don't want to change the default behavior of the extension right now, so I'll add this in as an option.

function _formatHTML(unformattedText, indentChar, indentSize) {

        var formattedText = html_beautify(unformattedText, {
            indent_size: indentSize,
            indent_char: indentChar,
            max_char: 0,
            unformatted: []
        });

        return formattedText;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants