Keeping New lines
See original GitHub issueWould it be possible to keep original newlines by simply adding: preserve_max_newlines:1 to beautify options?
By modifying n_newlines condition it’s “probably” easy to preserve the nl. What do you think?
--- beautify.js 2012-02-14 15:37:23.000000000 +0100
+++ beautify.js 2012-02-14 15:55:37.000000000 +0100
@@ -345,7 +345,7 @@ function js_beautify(js_source_text, opt
}
if (opt_preserve_newlines) {
- if (n_newlines > 1) {
+ if (n_newlines > 0) {
for (i = 0; i < n_newlines; i += 1) {
print_newline(i === 0);
just_added_newline = true;
Of course if the patch is wrong i’d like to understand why.
Thanks
Issue Analytics
- State:
- Created 12 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
How to Preserve Newlines, Line Breaks, and Whitespace in ...
If you want your text to overflow the parent's boundaries, you should use pre as your CSS whitespace property. Using white-space: pre wraps ......
Read more >How do I preserve newlines in a quoted string in Bash?
Add quotes to make it work: echo "$MYSTRING". Look at it this way: MYSTRING="line-1 line-2 line3" echo $MYSTRING. this will be executed as:...
Read more >Preserve Linebreaks When Storing Command Output to a ...
See why linebreaks in a shell variable can disappear in echo's output and learn the right way to use shell variables in commands....
Read more >How to keep new lines from a string variable in email body
To do that I've introduced a string variable and appending data to it in Apply to each cycle. Data inside the variable have...
Read more >how to keep newline characters in command execution result?
1 · Insert newline when grep result is empty · awk, bash, shell scripts, solved · JBVeenstra ; 2 · Removing newline characters...
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
I know this issue was created with js in mind, but it would be great to have a fix for HTML as well.
Please file a new issue.