繁体   English   中英

有没有办法防止Prettier触摸<pre> blocks in HTML files?

[英]Is there a way to prevent Prettier from touching <pre><code> blocks in HTML files?

Prettier 通常在 HTML 上做得很好,但缩进了 pre>code blocks。

我总是希望预> 代码块不缩进。

似乎我应该能够在 .prettierignore 中配置它,但找不到有效的方法。

块像:

<pre class="line-numbers"><code class="language-json">"operations": [
    "video-cloud/video/all",
    "video-cloud/playlist/all",
    "video-cloud/sharing-relationships/all",
    "video-cloud/notifications/all"
]</code></pre>

像这样缩进:

      <pre class="line-numbers"><code class="language-json">"operations": [
    "video-cloud/video/all",
    "video-cloud/playlist/all",
    "video-cloud/sharing-relationships/all",
    "video-cloud/notifications/all"
]</code></pre>

我希望块保持原样。

您可以忽略某些文件,但不能忽略部分代码。

引用已删除的答案:

我个人不使用该扩展程序,但似乎 prettier 已为其内置配置: https : //prettier.io/docs/en/ignore.html

IIUIC,解决方案是

<!-- prettier-ignore-start -->
block to keep
<!-- prettier-ignore-end -->

投票通过“cas vl”取消删除答案,因为它让我在几秒钟内找到了解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM