i want to save just <img scr="" alt="">
but my visual studio code save automatically <img scr="" alt="" />
I have prettier installed
No matter how hard I looked in the Visual Studio Code, I couldn't find it.
i want to save just <img scr="" alt="">
but my visual studio code save automatically <img scr="" alt="" />
I have prettier installed
No matter how hard I looked in the Visual Studio Code, I couldn't find it.
According to Github page of Prettier, it is valid* and intended behavior
*it does comply with HTML5 standard
Like Kaper365 said it is the intended behavior.
Also, HTML allows empty tags like <img/>
, <br/>
, <input/>
, etc... to not have the self closing, but XHTML do not allow that.
So instead of doing like your friends, maybe would be better to get used to a style that is valid both markup languages. This way, if you get a job where the framework uses XHTML or HTML you know how to do it either way.
Stll, if you really want to remove the self closing the anwser is no, prettier doesnt do that but you can you this workaround instead: How to stop Prettier from using the old self closing tag syntax.
Its <img scr="" alt="">
and <img scr="" alt="" />
both are valid, and its prettier's philosophy (https://github.com/prettier/prettier/issues/5641) and its can't be changed but still you can change it by adding below changes in VS Code,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
For your references I've attached links which could help you to resolve your problem. https://prettier.io/docs/en/ignore.html How do I stop prettier from formatting HTML files?