VSCode's formatter automatically inserts a newline before <head>
and <body>
tags and also before the closing </html>
tag by default. In the default settings the following lines exists:
// List of tags, comma separated, that should have an extra newline before them. 'null' defaults to "head, body, /html".
"html.format.extraLiners": null,
I tried setting html.format.extraLiners
in the user settings to ""
and also to "none"
but it didn't change anything.
This is what I get:
<html>
<head></head>
<body></body>
</html>
This is what I want:
<html>
<head></head>
<body></body>
</html>
How can you prevent VS Code from breaking up long HTML lines into multiple lines? My solution: Select the SVG you want to convert to single line. Then press F1 and type Join Lines and hit enter.
To do this you need to navigate to Code > Preferences > User Snippets and search for 'html. json'. Then you add your custom snippets into this file.
I had the "JS-CSS-HTML Formatter" extension installed, which was causing the problems. After uninstalling it, everything now works as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With