Amit Agarwal has a useful formatting trick to share: "The <pre> tag that defines preformatted text is the only tag in HTML that respects and preserves whitespaces like line-breaks, blanks, tabs and multiple spaces between words. Whatever is enclosed inside the pre element will be displayed as-it-is on the web browser.
The pre tag is therefore an excellent choice when you like to show a code snippet in your blog preserving the tabs and line breaks. Infact, most of the Adsense Javscript code snippets that you see on this blog are displayed using
Cleaning the code in the edited content is one important new addition in KTML 4. You have the option to choose from cleaning only the Word tags, only the CSS formatting, or cleaning all the formatting tags inside the code. Saving the code as XHTML compliant is also one of KTML's possibilities.
To make this completely possible, you must however install and configure the HTML Tidy utility:
1.
Download and install the HTML Tidy version suited for your particular server configuration. You need a version released in 2005 or higher.
2.
If you are
Back when I was working on BorlandC#Builder I made the decision to incorporate the W3C's HTML Tidy formatting tool directly into the IDE. It has lots of options and does a nice job of formatting and correcting errors. There are several ways to leverage HTML Tidy in the IDE, for example when editing an HTML file from the code editor you can select Edit | HTML Tidy | Format Document or Edit | HTML Tidy | Check Document for Errors. Additionally, you can also select to use HTML Tidy as the default HTML formatter for both HTML and ASP.NET pages. What
The documentation would have to improve considerably to be atrocious, the module has some head scratching limitations, and is slow.
Installation on Darwin 8.5.0/perl 5.8.6 was a nightmare of dependency resolution, whether by hand or by cpan. The author might have mentioned that the htmltidy source and headers have to be present before installation in the instructions. While the documentation does mention to "tell the makefile that you're using ranlib", that convoluted set of instructions doesn't actually address the problem I had.
That aside, on
For people who are not very good at writing their own HTML or who want to clean up the output from a WYSIWYG (what you see is what you get) web editor so that the HTML actually validates thhen using the HTML Tidy program originally written by Dave Raggett is probably the best solution. This program will fix most of the errors that might be in the HTML for you and even does a reasonable job of removing most of the garbage that Microsoft Word insists on writing into files when you ask it to output in HTML format.
The program even adjusts the formatting