Format html code in Visual Studio Code such that attributes are on separate lines?

前端 未结 4 1203
梦如初夏
梦如初夏 2020-12-25 10:22

There seems to be a lack of formatting settings for vscode. I want to be able to format html such that my html shows up as:

4条回答
  •  庸人自扰
    2020-12-25 11:03

    There are differnt "formatter" extensions, but one I found does a decent job of this exact formatting that you are looking for. It's called "vscode-tidyhtml".

    https://marketplace.visualstudio.com/items?itemName=anweber.vscode-tidyhtml

    1. Click on the Extensions icon on the left hand side
    2. Search for and install "vscode-tidyhtml", reload Visual Studio Code
    3. Hit the "F1" key, and then type "TidyHtml", hit enter

    It should format HTML so that attributes are on different lines. I am not sure if it works well for other file types.

提交回复
热议问题