html - 在 Visual Studio Code 中格式化 html 代码,使属性位于不同的行

vscode 似乎缺少格式设置。 我希望能够格式化 html,以便我的 html 显示为:

<div attrib1=value1
     attrib2=value2
     attrib3=value3>
  Content
</div>

这是我非常想拥有的一项功能!

最佳答案

VSCode 现在添加了一种方法来执行此操作。 您可以编辑您的 settings.json (ctrl+shift+p),然后添加以下内容以获得所需的效果:

"html.format.wrapAttributes": "force-aligned"

--或--

"html.format.wrapAttributes": "force"

force-aligned 还会添加缩进以使其与打开标签的行上的属性对齐。

访问 this link了解更多详情或更新。

关于html - 在 Visual Studio Code 中格式化 html 代码,使属性位于不同的行上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33560205/

相关文章:

eclipse - 格式化后无法删除 Eclipse 中的 block 注释

formatting - 复制/粘贴到 Word 时如何保留 rstudio 的格式?

java - String.format 或类似的正确格式字符串

emacs - 在 Emacs 中,如何在一系列初始化语句中排列等号?

c# - 如何格式化 Visual Studio 2012 中的所有文件?

c++ - 如何使用具有类似 printf 格式的 C++ std::ostream?

documentation - reStructuredText 中粗体字的一部分

python - 从 Python 日期/时间获取 "2:35pm"而不是 "02:35PM"?

coding-style - 线宽格式标准

android - 点后 2 位 float