Lej*_*-_- 13 html tags visual-studio-code prettier
所以我最近安装了 prettier,每当我保存文件时,它都会在自闭合标签中添加正斜杠。我想知道如何阻止它这样做?
\n这就是我的意思:-
\n<!-- Instead of this \xe2\x86\x93 -->\n<input type="text">\n\n<!-- It does this \xe2\x86\x93 -->\n<input type="text" />\nRun Code Online (Sandbox Code Playgroud)\n先感谢您
\nzdo*_*lny 11
由于 Prettier 哲学,它无法更改,请参阅: https: //github.com/prettier/prettier/issues/5641
但您可以通过添加设置来将 HTML 文件的格式从 Prettier 更改为 VS Code 的格式化程序:
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
Run Code Online (Sandbox Code Playgroud)
就像这个答案:/sf/answers/4665262591/