Skip to content

Option to drop non-essential <html>, <head>, and <body> #22

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

Closed
towolf opened this issue Mar 20, 2012 · 5 comments
Closed

Option to drop non-essential <html>, <head>, and <body> #22

towolf opened this issue Mar 20, 2012 · 5 comments

Comments

@towolf
Copy link

towolf commented Mar 20, 2012

HTML5 without these tags validates, since they are implied. Could you add an option to drop these tags?

@sideshowbarker
Copy link
Contributor

Try "tidy --hide-endtags yes". Despite the name, I think it causes all optional tags to be omitted, including start tags.

@towolf
Copy link
Author

towolf commented Mar 24, 2012

Confirming that’s the case.

Would you document this and/or change the name so this is obvious?

@sideshowbarker
Copy link
Contributor

Added http://w3c.github.com/tidy-html5/quickref.html#omit-optional-tags and rewrote http://w3c.github.com/tidy-html5/quickref.html#hide-endtags to read, "This option is an alias for omit-optional-tags."

@towolf
Copy link
Author

towolf commented Mar 24, 2012

Thank you.

One problem with this, in combination with -i, is that the indents are odd:

towolf@ovo:~$ tidy -i -w 80 firstblush.html  | head -n 22
line 9 column 1 - Warning: inserting implicit <body>
<!DOCTYPE html>

<html>
<head>
  <title>firstblush</title>
  <meta charset="utf-8">
  <meta name="author" content="towolf">
  <meta name="generator" content="pandoc">
  <link rel="stylesheet" href="pandoc.css">
</head>

<body>
  <header>
    <h1 class="title">firstblush</h1>

    <h2 class="author">towolf</h2>

    <h3 class="date">01. März 2012</h3>
  </header>

  <p>Facilities to capture, process, analyse, modify, register, mix &amp;


towolf@ovo:~$ tidy -i -omit -w 80 firstblush.html  | head -n 22
line 9 column 1 - Warning: inserting implicit <body>
<!DOCTYPE html>

<title>firstblush</title>
  <meta charset="utf-8">
  <meta name="author" content="towolf">
  <meta name="generator" content="pandoc">
  <link rel="stylesheet" href="pandoc.css">

<header>
    <h1 class="title">firstblush</h1>

    <h2 class="author">towolf</h2>

    <h3 class="date">01. März 2012</h3>
  </header>

  <p>Facilities to capture, process, analyse, modify, register, mix &amp;

@sideshowbarker
Copy link
Contributor

Yeah, I see what you mean. I've never looked at the indenting code myself. Maybe somebody else will take an interest in it later. It seems to have a lot of quirks like the one you noticed.

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

No branches or pull requests

2 participants