Live data from Hacker News

HTML5 Tidy: The granddaddy of HTML tools

html-tidy.org

11–14 of 14 posts

Re: HTML5 Tidy: The granddaddy of HTML tools

#11

The one thing I find missing on the site is, when would I use it? What benefit or problem is it solving? Can anyone share when they've found this to be useful? For example, does it compress HTML for faster page loads, or fix invalid HTML (e.g. from wysiwyg editors).

tidy is a swiss army knife for HTML and XML... it does the things you said and a lot more.

Pretty printing, switching encodings, conversions between HTML/XHTML, validation, removing those stupid quotation marks that MS Word litters all over the place in its vain attempt to ruin the universe... many annoying problems with HTML are easily solved with tidy

Re: HTML5 Tidy: The granddaddy of HTML tools

#12

The one thing I find missing on the site is, when would I use it? What benefit or problem is it solving? Can anyone share when they've found this to be useful? For example, does it compress HTML for faster page loads, or fix invalid HTML (e.g. from wysiwyg editors).

It's mainly useful for 3rd party (or 'minified') HTML, just to make it readable. It's rare you'd want to use it on HTML you've written yourself.

Re: HTML5 Tidy: The granddaddy of HTML tools

#13

The one thing I find missing on the site is, when would I use it? What benefit or problem is it solving? Can anyone share when they've found this to be useful? For example, does it compress HTML for faster page loads, or fix invalid HTML (e.g. from wysiwyg editors).

It comes from the early web when scraping web pages was a thing. Html is not always clean, missing end tags, cross nested tags, invalid tags, misused tags or you need xhtml/xml compatible html so you can do xpath/xslt on it.

Re: HTML5 Tidy: The granddaddy of HTML tools

#14

Now, if someone could tell me how to use it within PHP... My company created an open-source HTML-diffing PHP package[0] that could be considerably improved by replacing the old Tidy with the HTML5 Tidy (if I only knew how!) [0] https://github.com/gathercontent/htmldiff

You're using the PHP extension based on libtidy:

https://github.com/gathercontent/htmldiff/blob/master/compos...

http://php.net/manual/en/book.tidy.php

Post reply on HN