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.

Preserve line-breaks on multiline HTML content

See original GitHub issue

Prettier 1.15.2 Playground link

Input:

<html>
  <body>
    <div id="test">
      aa
    </div>
  </body>
</html>

Output:

<html>
  <body>
    <div id="test">aa</div>
  </body>
</html>

Expected behavior: Preserve line-break before and after “aa”.

<html>
  <body>
    <div id="test">
      aa
    </div>
  </body>
</html>

This situation is similar to preserve multiline array notation of JavaScript.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hawkrivescommented, Nov 29, 2018

When you say “required”, are you saying that the lack of newlines there breaks your app, or that you prefer the formatting with them?

1reaction
j-f1commented, Nov 26, 2018

You could use try overriding the printWidth for HTML files only @AndreasGassmann.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preserve line breaks in textarea - html - Stack Overflow
The line breaks the user entered are preserved, neither html nor php simply drops or alters anything. However html markup, when rendered for ......
Read more >
How to Preserve Newlines, Line Breaks, and Whitespace in ...
Preserve Newlines, Line Breaks, and Whitespace in HTML. Use the white-space: pre; setting to display long-form content containing whitespace ...
Read more >
The Dos and Don'ts of Adding an HTML Line Break
To do a line break in HTML, use the <br> tag. Simply place the tag wherever you want to force a line break....
Read more >
PRESERVING LINE BREAK IN MULTI LINE TEXT BOX - MSDN
Lets say I have a multiline textbox and a user types a message in there. I want to save the message in the...
Read more >
How to Preserve Line breaks while copying and past...
Hi All - I want to preserve the line breaks while copying and pasting the text from String field to HTML field.
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