在eclipse中的<head> </ head>中缩进标签

Seg*_*ult 21 html eclipse indentation auto-indent

<head>...</head>当我按下Ctrl + Shift + F时,我需要Eclipse(Kepler)缩进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>
Run Code Online (Sandbox Code Playgroud)

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

<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>
Run Code Online (Sandbox Code Playgroud)

我需要<head>...</head>缩进内部的所有内容以及其中的所有标记<html>...</html>.

理想情况下这样:

function func() {
  console.log("Hello world");
}
Run Code Online (Sandbox Code Playgroud)
<html>

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

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

</html>
Run Code Online (Sandbox Code Playgroud)

Ano*_*kim 1

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

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

  • 缩进与上述内容正确配合。不要说毫无意义的答案,而是提供另一个解决方案。 (3认同)