html - 配置 prettier 以在 html 中保留空白喜欢
问题描述
从 Prettier 文档中,我看到处理空白行的一般方法是:(来源)
空行
事实证明,空行很难自动生成。> Prettier 采用的方法是保留原始源代码中的空行。> 还有两个附加规则:
- Prettier 将多个空行折叠成一个空行。
- 块(和整个文件)开头和结尾的空行被删除。(不过,文件总是以一个换行符结尾。)
但如果我尝试:
<div>
<!-- I want to preserve the blank line above -->
<div>
</div>
<!-- the line above this is preserved, good! -->
<div>
</div>
</div> <!-- and how about preserving the line above this one -->
我明白了
<div>
<!-- I want to preserve the blank line above -->
<div></div>
<!-- the line above this is preserved, good! -->
<div></div>
</div>
<!-- and how about preserving the line above this one -->
看看这个现场更漂亮的游乐场
我怎样才能告诉 prettier 保留那些空行?
解决方案
推荐阅读
- node.js - 在 AWS 上的 NGINX Web 服务器上运行的 NodeJS 中无法找出 504 错误
- java - Gradle:无法实例化 SLF4J LoggerFactory 错误
- amazon-web-services - 进出 AWS Api Gateway 的不同响应
- javascript - 如何向非营利网站添加捐赠功能?
- python - Django 不在数据库中存储密码
- go - 在不知道它们的类型的情况下比较来自两个接口的结构字段?
- azure - Azure 应用服务自定义域 - 网站功能不同
- r - 为什么我不断收到关于 Else 语句的错误?
- swift - 在 Xcode 中出现“无法打开权利”错误
- python-2.7 - Luigi:有没有办法像在 configparser 中那样使用扩展插值?