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
148
votes
5 answers

A command-line HTML pretty-printer: Making messy HTML readable

I'm looking for recommendations for HTML pretty printers which fulfill the following requirements: Takes HTML as input, and then output a nicely formatted/correctly indented but "graphically equivalent" version of the given input HTML. Must support…
knorv
  • 49,059
  • 74
  • 210
  • 294
49
votes
9 answers

Notepad++ HTML Tidy

Is HTML Tidy for Notepad++ broken? None of the commands except Tidy (the first one) work. They don't show any message, even with all text selected. I really need Tidy to work, or is it just a limitation of the newest version of N++, or lack of…
Aethex
  • 1,502
  • 2
  • 16
  • 27
41
votes
3 answers

Select groups which have at least one of a certain value

How to select groups based on a condition on the individual rows, say keep all groups that contain at least one (ANY) of a certain value, e.g. 4, (or any other condition that is TRUE at least once). Or phrased the other way around: if a group does…
Matifou
  • 7,968
  • 3
  • 47
  • 52
36
votes
2 answers

PHP generated XML shows invalid Char value 27 message

I am generating XML using PHP library as below: $dom = new DOMDocument("1.0","utf-8"); Doing above results in a page which shows a message on top of the output. This page contains the following errors: error on line 16 at column 274505: PCDATA…
Prashant
  • 2,005
  • 3
  • 17
  • 24
35
votes
5 answers

Formatting PHP Code within Vim

I'm currently using Vim as a lightweight IDE. I have NERDTree, bufexplorer, supertab, and ctags plugins which do almost everything I want. Only big thing missing for me is auto code formatting. I'm working with some messy PHP code which has…
gacrux
  • 930
  • 1
  • 9
  • 16
33
votes
3 answers

PHP "pretty print" HTML (not Tidy)

I'm using the DOM extension in PHP to build some HTML documents, and I want the output to be formatted nicely (with new lines and indentation) so that it's readable, however, from the many tests I've done: "formatOutput = true" doesn't work at all…
Jack Sleight
  • 17,010
  • 6
  • 41
  • 55
23
votes
4 answers

Is there an alternative to HTML Tidy?

I have embedded HTML Tidy in my application to clean incoming HTML. But Tidy has a huge amount of bugs and fixing them directly in the source is my worst nightmare. Tidy source code is an unreadable abomination. Thousand+ line functions, poor…
Lucas
  • 6,328
  • 8
  • 37
  • 49
19
votes
3 answers

How do I get HTML Tidy to not put newline before closing tags?

HTML Tidy has this infuriating habit of putting a newline before the closing tag. For example:

Some text

becomes

Some text

How do I tell Tidy to keep the closing tag on the same line as the end of the content? Btw, I am running Tidy…
markvgti
  • 4,321
  • 7
  • 40
  • 62
19
votes
1 answer

Prevent tidy from adding html tags

I have a class that generates some html (form elements and table elements), but this class returns all the html in one line. So I am trying to use tidy to beautify the code (indent the code, put line breaks, etc), the only problem I am having is…
AntonioCS
  • 8,335
  • 18
  • 63
  • 92
18
votes
6 answers

Install Tidy, PHP

I guess when php was installed on my box --with-tidy arg was not included. When browsing my php.ini the line: ;extension=php_tidy.dll is missing. How can I add the module to my php install? Note I tried adding: extension=php_tidy.dll but with no…
KyleT
  • 855
  • 1
  • 12
  • 18
14
votes
3 answers

Tidy for Jinja2 templates

Is there a tidy-like tool or a tidy configuration, which works fine with Jinja2 templates? The default tidy has problems with Jinja code in attributes and Jinja-loops are formated in an unreadable way. My main requirement is to get the indentation…
Achim
  • 15,415
  • 15
  • 80
  • 144
12
votes
1 answer

Error - No tidy method for objects of class lmerMod

I am using a dataset from an online practice tutorial and the code can be found at the bottom of Page 4 (https://tomhouslay.files.wordpress.com/2017/02/indivvar_mv_tutorial_asreml.pdf) In the tutorial, they get the function to work using the code…
qsxsqsxs
  • 161
  • 1
  • 8
11
votes
1 answer

Tidy replacing   with a weird character

I am using Tidy (with PHP5) with UTF8 input, output, and char encoding enabled. When I clean a string with an   in it, it is replacing it with an odd character. I've tried messing with the tidy config but nothing I try seems to work. Before…
Slickrick12
  • 897
  • 1
  • 7
  • 21
11
votes
2 answers

How to tidy up R code?

I know that many programming languages have tools to tidy up programming code? Is there a way to tidy up R code or some tools that will do this (e.g. included in R IDE's?)?
jrara
  • 16,239
  • 33
  • 89
  • 120
10
votes
2 answers

How to tidy angular html?

I'm using tidy-html5 from brew, and i can't tidy up my angular templates because they use custom elements like those : This throws this error on tidy-html5 : line 26 column 9 - Error:…
Eduardo Moniz
  • 2,095
  • 3
  • 18
  • 27
1
2 3
38 39