A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
To update files in-place:
$ htmlbeautifier file1.html.erb [file2.html.erb ...]or to operate on standard input and output:
$ htmlbeautifier formatted.html.erbrequire 'htmlbeautifier'
beautiful = HtmlBeautifier.beautify(untify_html_string)You can also specify how to indent (the default is two spaces):
beautiful = HtmlBeautifier.beautify(untidy_html_string, indent: "\t")This is a Ruby gem.
To install the command-line tool (you may need sudo):
$ gem install htmlbeautifierTo use the gem with Bundler, add to your Gemfile:
gem 'htmlbeautifier'No open issues yet, or sync has not completed.