Add an option to strip empty lines
See original GitHub issueIt would be useful if JS Beautify had an option to strip empty lines.
Includes, partials and other serverside code can create blank lines in the HTML. The HTML would be more beautiful without these blank lines.
This used to be the behaviour in version 1.3.1 but I think it was changed for https://github.com/einars/js-beautify/issues/285.
Input:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
</head>
<body>
<p>P1</p>
<p>P2</p>
</body>
</html>
(Note: the line after P1 should contain some spaces and tabs but GitHub Flavored Markdown is removing them. This line should still be removed by JS Beautify.)
Configuration:
js-beautify input.html -o output.html --remove-empty-lines
Expected output:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
</head>
<body>
<p>P1</p>
<p>P2</p>
</body>
</html>
Actual output:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
</head>
<body>
<p>P1</p>
<p>P2</p>
</body>
</html>
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Remove empty lines - Visual Studio Marketplace
Remove blank lines from document or selection. ... Launch VS Code Quick Open ( Ctrl+P ), paste the following command, and press enter....
Read more >How to Remove Blank Lines from a File - Computer Hope
Open TextPad and the file you want to edit. · Click Search and then Replace. · In the Replace window, in the Find...
Read more >How to remove empty lines in Visual Studio Code
Open your code in Visual Studio Code · From Edit Menu, select Replace or use a short cut key (command + Option +...
Read more >Remove blank lines from text file - UltraEdit
This will delete all lines in the file that contain no characters or whitespace. If text is selected, then the operation is restricted...
Read more >Adding or removing blank lines - IBM
Only the reverse of the currently active option is available from the View menu. That is, if Add Blank Lines is in effect,...
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
Hi, can you add same option for css?
Yeah, I see your point. Until we get to fixing this, have you tried
1
instead of0
? Does that exhibit the behavior you want?