Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy deletes empty tags #669

Closed
ghost opened this issue Jan 28, 2018 · 2 comments
Closed

Tidy deletes empty tags #669

ghost opened this issue Jan 28, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 28, 2018

When running tidy with html containing empty tags, many empty tags are simply removed. For example i, span and li elements. This is a problem as many of these elements are in fact significant, as can be seen in my example.

My version string: "HTML Tidy for Linux version 5.4.0"

A minimal, verifiable example:

<!doctype html>
<html lang="en">
  <head>
    <link href="vendors/css/ionicons.min.css" rel="stylesheet"/>
  </head>
  <body>
    <span class="ion-bug"></span>
  </body>
</html>
$  cat test.html | tidy > test1.html

produces

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.4.0">
<link href="vendors/css/ionicons.min.css" rel="stylesheet">
<title></title>
</head>
<body>
</body>
</html>
@geoffmcl
Copy link
Contributor

@Jeremiah-B, yes, that is the default action of tidy...

See drop-empty-elements... the default is yes... and that is the same in release 5.4.0 that you show you are using...

Try adding a config --drop-empty-elements no on the command line, or add drop-empty-elements: no to a config file, then add -config /path/to/tidy.conf... and advise... thanks...

It is normal to set up a default config file, like say $HOME/tidy-def.conf, with the options you like, and add, export HTML_TIDY=$HOME/tidy-def.conf before running tidy... and there are other ways to do this... we all have very different preferences when running tidy...

@geoffmcl geoffmcl added this to the 5.7 milestone Jan 29, 2018
@geoffmcl
Copy link
Contributor

geoffmcl commented May 3, 2018

@Jeremiah-B since there has been no further feedback in months, assume this is question asked and answered, so closing this...

Feel free to re-open, or post a new issue... thanks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant