Skip to content

Incorrect indentation for script tag #56

Closed
@sjmulder

Description

@sjmulder

Input:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <p>Paragraph 1</p>
        <p>Paragraph 2</p>
        <script>
            function() {
                return 'Hello, World!';
            }
        </script>
        <script src="foo.js"></script>
    </body>
</html>

Command (no config file):

tidy --indent 1 --indent-spaces 4 input.html

Output:

<!DOCTYPE html>
<html>
    <head>
        <meta name="generator" content=
        "HTML Tidy for HTML5 (experimental) for Mac OS X https://github.com/w3c/tidy-html5/tree/68a9e74">
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <p>
            Paragraph 1
        </p>
        <p>
            Paragraph 2
        </p><script>
    function() {
                return 'Hello, World!';
            }
        </script> <script src="foo.js">
</script>
    </body>
</html>

Issues:

  • There is no newline between the closing tag for paragraph 2 and the opening script tag
  • The script tag is closed on the wrong line

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions