beautifier/js-beautify

Beautification problem with JS Single Line Comment <!--

Open

#1,835 opened on Aug 31, 2020

View on GitHub
 (10 comments) (0 reactions) (1 assignee)JavaScript (1,460 forks)batch import
good first issuelanguage: javascripttype: bug

Repository metrics

Stars
 (8,342 stars)
PR merge metrics
 (Avg merge 51d 1h) (16 merged PRs in 30d)

Description

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

Contributor guide