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.

HTML Suddenly formatting improperly

See original GitHub issue

Prettier is suddenly formatting html in a strange way, adding closing slashes to <hr> elements, dropping brackets/carats to the next line, leaving single > on their own line. In the image below, this happened with much more than the anchor tag and was consistent on several other elements, but after formatting to take the product-specific code out of the html, some of the formatting corrected itself; it seems to be based on length of copy and other factors, but without being able to nail down what’s happening, or why it started happening recently, not sure how to configure preferences to remove this behavior.

formatting-issues

Issue Analytics

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

github_iconTop GitHub Comments

15reactions
CiGitcommented, Jan 30, 2019

This is how prettier now prints HTML (this is quite new) Things are improving over time. You can play with htmlWhitespaceSensitivity

There is nothing we can do here

Or you can disable html and use an other formatter for it.

13reactions
dpipcommented, Dec 2, 2019

If you are ok with VSCode’s stock HTML formatting, these lines in settings.JSON worked for me:

"editor.formatOnSave": true, "[html]": { "editor.defaultFormatter": "vscode.html-language-features" }

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix improper <pre> formatting in html on mobile device?
I have tried putting the ascii directly inside the . html page, but it has the same results, so it's not an issue...
Read more >
Websites look wrong or appear differently than they should
This article explains how to fix problems with websites that display incorrectly in Firefox or don't work the way they should.
Read more >
HTML formatting seems very bad; is it me? - Genuitec
However, in some cases the formatter is completely useless for me (and others) now; especially with the anchor tag. Any file that has...
Read more >
A website looks weird - WhatIsMyBrowser.com
Perhaps parts of it haven't loaded or the sizing is all wrong... Here's a few things you can try to fix the problem....
Read more >
Understanding why your CSS fails - LogRocket Blog
We're learning CSS the wrong way. For starters, we humans are ... Block formatting context is the least well-known, so let's start there....
Read more >

github_iconTop Related Medium Post

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