indenting tags within <head></head> in eclipse

1.4k views Asked by At

I need Eclipse(Kepler) to indent html tags within <head>...</head> when I hit Ctrl+Shift+F

Currently, this:

<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>

becomes this when I hit the key combination.

<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>

I need everything within <head>...</head> to be indented and also all the tags within <html>...</html>.

Ideally this way:

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>

1

There are 1 answers

3
Anokim On

You could try to go to: Window > Preferences > Web > HTML Files > Editors.

Add/Remove what you want to indent from the inline field. From what I saw it doesn't include the head tag, so try adding in the list.