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.5k stars 454 forks source link

Beautify html not following the rules #1422

Closed tonylin0826 closed 7 years ago

tonylin0826 commented 7 years ago

Description

The results of beautification are not what I expect. I set the indent size to 2, but it still indent 4.

If i disable the angulars package and restart, it work normally.

Input Before Beautification

This is what the code looked like before:

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Actual Output

The beautified code actually looked like this:

<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
    </head>
    <body>

        <h1>This is a Heading</h1>
        <p>This is a paragraph.</p>

    </body>
</html>

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/tonylin0826/84c5a9da63908a5a4a403eb4b8686aee

Checklist

I have:

Glavin001 commented 7 years ago

Your file is being recognized as:

Original File Grammar: HTML (Angular)

Original File Language: EJS

and therefore is using the EJS settings:

"ejs": {
        "indent_size": 4,

Instead of your HTML settings:

"html": {
        "indent_size": 4,

You can either configure EJS language settings or change the Atom grammar for your file. See https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md#ejs for available EJS options.