HTML Suddenly formatting improperly
See original GitHub issuePrettier 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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:17
- Comments:45 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
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.
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" }