Inserts spaces and line breaks into html string.


011.0.45 years ago5 years agoMinified + gzip package size for html-beautify in KB


alt tag

How it work?

Inserts spaces and break lines into html string. It looks like this:

<!-- Before -->
<div><p>Hello <b>world</b>!</p><p>How are you?</p></div>

<!-- After -->
  <p>Hello <b>world</b>!</p>
  <p>How are you?</p>

How to use?

import htmlBeautify from 'html-beautify'
htmlBeautify("<div><p>Hello <b>world</b>!</p></div>")
// => "<div>\n  <p>Hello <b>world</b>!\n  </p>\n</div>"

Also you can pass string with spaces and break lines, it will be remove it and add them again.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from