<meta charset="UTF-8" /> <img src="xxx.jpg" alt="xxx" /> なぜHTMLの空要素の最後に"/"が入るのか? Prettierのissue "Add an option to prefer void tags over self closing tags. #5246"、 ざっと読んだところこの仕様の理由は XML(XHTML)との互換性 読みやすさ などであり、設定で変更することはできない。 また別のissue"The formatting of self-closing tags in HTML5 #5641"によると、HTMLのフォーマッティングの開発時にそう決まったからだそう。 そして、オプションの理念ページには Prettier has a few options because of history. But we won’t
![PrettierでHTMLの空要素に"/"が入る(VS Code使用)](https://cdn-ak-scissors.b.st-hatena.com/image/square/962693b8509b55839338d92fe2debdd0d3078eaf/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs---3EgTFo7--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3APrettier%2525E3%252581%2525A7HTML%2525E3%252581%2525AE%2525E7%2525A9%2525BA%2525E8%2525A6%252581%2525E7%2525B4%2525A0%2525E3%252581%2525AB%252522%25252F%252522%2525E3%252581%25258C%2525E5%252585%2525A5%2525E3%252582%25258B%252528VS%252520Code%2525E4%2525BD%2525BF%2525E7%252594%2525A8%252529%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3A%2525E3%252582%25258F%2525E3%252581%2525BF%252Cx_203%252Cy_98%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL3plbm4tdXNlci11cGxvYWQvYXZhdGFyLzA3YjU3NTA0N2QuanBlZw%3D%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_72%2Fog-base.png)