You can set a prettier format as the default format for your editor to all programming languages by putting prettier properties in the setting.json
file.
"editor.defaultFormatter": "esbenp.prettier-vscode",
Prettier format for HTML doesn't look so cool in my opinion so I have set it to default VS Code format.
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
If you want the Beautify format extension to your HTML you can install the beautify extension and add this line in the setting.json
file
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
}
Similarly, you can set a different format extension to a different language. In my opinion, this is the standard way of setting the format extension to one or many languages.
You can do it like this
"beautify.language": {
"html": ["html", "php", "erb"],
},
Edited
All credits to @Fred.
You can achieve the same behavior of beautify extension in prettier by the following property.
"prettier.htmlWhitespaceSensitivity": "ignore"