jonschlinkert / pretty

Sensible presets and some tweaks for beautifying HTML with js-beautify according to my preferences.
MIT License
138 stars 17 forks source link

Not very pretty the output #8

Closed dominikwilkowski closed 5 years ago

dominikwilkowski commented 5 years ago

From the example:

const pretty = require('pretty');
const STRING_OF_HTML = `
  <body><img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" />
    <main>
      <div><img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> </div>
    </main><img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" />
  </body>`;
const output = pretty(STRING_OF_HTML);

Output will now be:

<body><img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" />
  <main>
    <div><img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> </div>
  </main><img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" /> <img src="http://via.placeholder.com/700x100?text=partial" />
</body>

That doesn't seem that pretty to me :( Downgrading to version 1.0.0 gives me at least:

<body>
  <img src="http://via.placeholder.com/700x100?text=partial" />
  <img src="http://via.placeholder.com/700x100?text=partial" />
  <img src="http://via.placeholder.com/700x100?text=partial" />
  <img src="http://via.placeholder.com/700x100?text=partial" />
  <main>
    <div>
      <img src="http://via.placeholder.com/700x100?text=partial" />
      <img src="http://via.placeholder.com/700x100?text=partial" />
      <img src="http://via.placeholder.com/700x100?text=partial" />
      <img src="http://via.placeholder.com/700x100?text=partial" /> </div>
  </main>
  <img src="http://via.placeholder.com/700x100?text=partial" />
  <img src="http://via.placeholder.com/700x100?text=partial" />
  <img src="http://via.placeholder.com/700x100?text=partial" />
  <img src="http://via.placeholder.com/700x100?text=partial" />
</body>
jonschlinkert commented 5 years ago

create an issue on js-beautify