user5176037
user5176037

Reputation:

How to use options in js-beautify plugin

JS noob here. I'm currently using js-beautify(https://github.com/beautify-web/js-beautify) plugin to properly indent/format a long string of HTML code. This is how I'm using it

html_beautify(HTML);

HTML is a variable containing regular HTML code. How can I pass options like disabling word-wrap or removing empty lines?

Upvotes: 1

Views: 629

Answers (1)

Zachary Kuhn
Zachary Kuhn

Reputation: 1152

It looks like you can add an object as the second parameter to handle your options:

html_beautify(elHTML, { preserve_newlines: false, wrap_line_length: 0 });

Upvotes: 1

Related Questions