Beautification problem with JS Single Line Comment <!--
See original GitHub issueIn 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Disable/Skip HTML single-line comment · Issue #426 - GitHub
I usually have a comment after the closing html tag in order to identify the tag on big files with a lot of...
Read more >Js-beautify wrap inline comments near css rules - html
I have a small issue with js beautify when I try to format my scss codebase. Input. The code looked like this before...
Read more >JavaScript Comments - W3Schools
JavaScript comments can be used to explain JavaScript code, and to make it more readable. ... This example uses a single-line comment before...
Read more >mjmlTest/node_modules/js-beautify/CHANGELOG.md - GitLab
css-beautify sibling combinator space issue (#1001); Bug: Breaks when the source code it found an unclosed multiline comment.
Read more >Comments in Julia - GeeksforGeeks
A multiline comment is useful when the comment text does not fit into one line; therefore needs to span across lines. Multi-line comments...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please refer to annex B1.3 of the ES6 espec. https://www.ecma-international.org/ecma-262/11.0/index.html#prod-annexB-SingleLineHTMLOpenComment
Although it’s a legacy support as noted:
Switch to JavaScript beautification an try the example from the original description.
alert(1)<!--commented