Skip to content

Feature request: trim whitespace from self-closing tags #806

Open
@ghost

Description

Replicate

Create a new file (index.html):

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <title>Title</title>
  <meta name="description" content="Description"/>
  <meta name="author" content="Author"/>
</head>
<body>
  <p>Hello, world!</p>
</body>
</html>

Then run:

tidy -asxml -m -q --wrap 0 --tidy-mark no --vertical-space auto index.html

Expected Results

The self-closing tags resemble:

<meta name="description" content="Description"/>

Actual Results

There's an extraneous space at the end of the HTML element that can be eliminated.

<meta name="description" content="Description" />

Additional Details

An option to trim self-closing tags of unnecessary whitespace would help reduce HTML file sizes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions