【问题标题】:atom beautifier html commentsatom 美化器 html 注释
【发布时间】:2018-03-05 15:44:54
【问题描述】:

我正在使用 atom 编写 html 和 atom beautify 来格式化代码。它工作得很好,但是有一个问题让我的代码有点混乱。这是我想要的代码:

<section id="hero">
  <div class="container">
    <div class="row">
      <div class="col-sm-8">

        <p>Hello world!</p>

      </div><!--/col-->
    </div><!--/row-->
  </div><!--/container-->
</section><!--/hero-->

这是他们用 atom beautify 制作的代码:

<section id="hero">
  <div class="container">
    <div class="row">
      <div class="col-sm-8">

        <p>Hello world!</p>

      </div>
      <!--/col-->
    </div>
    <!--/row-->
  </div>
  <!--/container-->
</section>
<!--/hero-->

如您所见,它将 html 注释放在一个新行中,然后我的代码中有不必要的行,而且立即看到结束标记也不那么容易。有没有办法配置美化器?

【问题讨论】:

  • 如果它们使用正则表达式后有注释的开头,则删除换行符

标签: html atom-editor atom-beautify


【解决方案1】:

我没有看到解决方案。 atom-beautify 包允许您以多种方式对其进行配置。其中之一是adding tags to be excluded from formatting。但是,当我通过将 "!--/col--" 添加到数组来测试它时,我得到的是 sn-p 的整个后端未格式化。

<section id="hero">
    <div class="container">
        <div class="row">
            <div class="col-sm-8">

                <p>Hello world!</p>

            </div>
            <!--/col-->
    </div><!--/row-->
  </div><!--/container-->
</section><!--/hero-->

【讨论】:

    猜你喜欢
    • 2016-02-08
    • 2018-09-11
    • 1970-01-01
    • 2022-08-04
    • 2015-10-08
    • 2014-04-19
    • 2019-02-07
    • 2018-09-08
    • 2016-08-29
    相关资源
    最近更新 更多