question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keeping New lines

See original GitHub issue

Would 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:closed
  • Created 12 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jonschlinkertcommented, Jun 5, 2013

I know this issue was created with js in mind, but it would be great to have a fix for HTML as well.

0reactions
bitwisemancommented, Jun 5, 2013

Please file a new issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found