Reputation: 361
I have a small web application that outputs html and css code at the end, but it's necessary to reindent the output, especially the css. I found this library: https://github.com/beautify-web/js-beautify But it doesn't seem to work. For instance, one of the files says:
Usage:
style_html(html_source);
style_html(html_source, options);
but all I get is an error: style_html is not defined. I've included one set of script tags as it says in the usage section.
example:
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify-css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.8/beautify-html.min.js"></script>
<script> style_html("asdf");</script>
any ideas?
Upvotes: 2
Views: 1469
Reputation: 943100
See the source code:
// If we're running a web page and don't have either of the above, add our one global window.html_beautify = function(html_source, options) { return style_html(html_source, options, window.js_beautify, window.css_beautify); };
The global is called html_beautify
, not style_html
(which is a function that is only used internally).
Upvotes: 2