Questions tagged [tidy]

Tidy is a C library for cleaning up "bad" HTML. Don't use this tag for questions about keeping your code tidy.

Tidy is a library written in C for converting HTML that is syntactically incorrect to correct HTML or to XHTML. Especially useful when you are scraping web pages with curl and XML parsing functions because XML parsing functions don't accept bad HTML. Extensions for Tidy are available in PHP and Perl. The Tidy extension in PHP supports functions to covert bad HTML to XHTML with various options like dropping deprecated tags like font tag and hiding comments and dropping proprietary tags and dropping empty paragraphs and a lot more.

571 questions
9
votes
4 answers

Pretty-print HTML via PHP without validation?

I'd like to automatically pretty-print (indentation, mostly) the HTML output that my PHP scripts generate. I've been messing with Tidy, but have found that in its efforts to validate and clean my code, Tidy is changing way too much. I know Tidy's…
brianjcohen
  • 965
  • 2
  • 10
  • 14
9
votes
3 answers

Passing a column name to R tidyr spread

I am trying to pass an object with the column name to the spread function, but instead of reading the value inside the object it just tries to use the object name itself Here just a toy example library(tidyr) d = (1:4) n = c("a"," a", "b","b") s =…
user2963882
  • 625
  • 1
  • 8
  • 19
9
votes
3 answers

Prevent PHP Tidy from converting style tag data to CDATA

I am using php tidy to clean a user generated HTML page which contains a style tag : But once I run the Tidy, the style tag data is converted…
Kshitiz
  • 2,852
  • 5
  • 32
  • 41
8
votes
4 answers

Php tidy and text areas

I am using tidy to clean up and format the output of HTML generated by the twig template engine. I am using the following configuration for tidy: $config = array('indent' => TRUE, 'output-html' => TRUE, 'wrap' => 0); Everything works nice and well,…
F21
  • 32,163
  • 26
  • 99
  • 170
8
votes
2 answers

Cleaning HTML with Nokogiri (instead of Tidy)

The tidy gem is no longer maintained and has multiple memory leak issues. Some people suggested using Nokogiri. I'm currently cleaning the HTML using: Nokogiri::HTML::DocumentFragment.parse(html).to_html I've got two issues though: Nokogiri removes…
Christian Joudrey
  • 3,441
  • 25
  • 25
8
votes
3 answers

DOMDocument: Ignore Duplicate Element IDs

I'm putting some page content (which has been run through Tidy, but doesn't need to be if this is a source of problems) into DOMDocument using DOMDocument::loadHTML. It's coming up with various errors: ID x already defined in Entity, line X Is…
James Inman
  • 1,030
  • 4
  • 15
  • 31
8
votes
1 answer

PHP Extension using libtidy compiles, but does not load

I wrote an extension in C++ that uses libtidy, and it runs perfectly under PHP when I compile PHP --with-tidy. However, it would be nice to have the extension run on a vanilla PHP. When I try to use the extension, I get something like: PHP Warning:…
eli
  • 645
  • 7
  • 15
8
votes
1 answer

Eclipse Galileo SQL Editor: is there a code formatter (tidy) function?

I do like the SQL editor now bundled with Eclipse but I can't seem to find a way for it to format my code like eclipse will with my java. Did I miss something, or does anybody have any alternatives? Thanks
Jason Tholstrup
  • 2,036
  • 3
  • 21
  • 25
8
votes
2 answers

PHP Tidy removes whitespace and inserts newlines

I'd like to use PHP Tidy to ensure my xml is valid before I load it into a DomDocument. However, I don't want Tidy to change something to my formatting - I only want it to repair problems like unbalanced tags, etc. An example of the problem can be…
hansmbakker
  • 1,108
  • 14
  • 29
8
votes
6 answers

Using Tidy2 for Notepad++

Something realy strange happend when i try use Tidy2 on my html pages. HTML Entities change from this   to this xA0 (screenshot) I try different settings in config file but nothing help. Please, some advise
Zhivago
  • 169
  • 1
  • 2
  • 10
8
votes
4 answers

HTML tidy/cleaning in Ruby 1.9

I'm currently using the RubyTidy Ruby bindings for HTML tidy to make sure HTML I receive is well-formed. Currently this library is the only thing holding me back from getting a Rails application on Ruby 1.9. Are there any alternative libraries out…
Christian
  • 302
  • 2
  • 8
7
votes
5 answers

An alternative to php tidy?

I use php tidy to process html input in my database, $fragment = tidy_repair_string($dom->saveHTML(), array('output-xhtml'=>1,'show-body-only'=>1)); I have this php_tidy turned on in my server but my live server doesn't support tidy, Fatal error:…
Run
  • 54,938
  • 169
  • 450
  • 748
7
votes
6 answers

HTML5 formatting on MacOS X? (preferably with TextMate)

Are there any editors or bundles available for MacOS X that support formatting of HTML5 documents? Tidy errors out on newer tags like canvas.
Eric the Red
  • 5,364
  • 11
  • 49
  • 63
7
votes
5 answers

Komodo Edit - HTML reformatting / Tidy

Is there a simple way to reformat my HTML from within Komodo Edit or to automate the process against Tidy? Something like the Ctrl+K, Ctrl+D in Visual Studio would be brilliant. I am presently running Ubuntu with Tidy installed.
Dave
  • 103
  • 1
  • 2
  • 6
7
votes
1 answer

Whats the HTML Tidy Config value to put every tag on a new line?

im trying to html tidy my document currently im' getting code like this though
samsong
  • 113
  • 1
  • 7
1
2
3
38 39