【问题标题】:indenting tags within <head></head> in eclipse在 Eclipse 中缩进 <head></head> 中的标签
【发布时间】:2014-11-26 10:30:26
【问题描述】:

当我点击 Ctrl+Shift+F

时,我需要 Eclipse(Kepler) 在 &lt;head&gt;...&lt;/head&gt; 中缩进 html 标签

目前,这个:

<html>
<head>
<title>Insert title here</title>
<script type="text/javascript">
function func() {
console.log("Hello world");
}
</script>
</head>
<body>
<p onclick="func()">Some text</p>
</body>
</html>

当我按下组合键时变成这个。

<html>
<head>
<title>Insert title here</title>
<script type="text/javascript">
    function func() {
        console.log("Hello world");
    }
</script>
</head>
<body>
  <p onclick="func()">Some text</p>
</body>
</html>

我需要缩进&lt;head&gt;...&lt;/head&gt; 中的所有内容以及&lt;html&gt;...&lt;/html&gt; 中的所有标签。

最好这样:

function func() {
  console.log("Hello world");
}
<html>

<head>
  <title>Insert title here</title>
  <script type="text/javascript">
    /* function */
  </script>
</head>

<body>
  <p onclick="func()">Some text</p>
</body>

</html>

【问题讨论】:

标签: html eclipse indentation auto-indent


【解决方案1】:

您可以尝试访问: 窗口 > 首选项 > Web > HTML 文件 > 编辑器。

从内联字段中添加/删除要缩进的内容。从我看到它不包含 head 标签,所以尝试添加到列表中。

【讨论】:

  • 毫无意义的答案,因为列表中有或没有(默认)head 不会改变缩进的方式。
  • 缩进在上述情况下正常工作。与其说无意义的答案,不如提供另一种解决方案。
  • 不幸的是,这不会产生 OP 要求的格式。似乎没有办法使用 Eclipse Kepler 来回答这个问题。
猜你喜欢
  • 1970-01-01
  • 2010-11-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多