In Javascript <!--
is treated as a single-line comment just like //
.
js-beautify works as expected when the line starts with <!--
:
Input:
<!--alert(1)commented
Output:
<!--alert(1)commented
Otherwise it will break the syntax:
Input:
alert(1)<!--commented
Output:
alert(1) < !--commented
Most helpful comment
Please refer to annex B1.3 of the ES6 espec.
https://www.ecma-international.org/ecma-262/11.0/index.html#prod-annexB-SingleLineHTMLOpenComment