Tidy Service

In yet another fit of late night browsing, I came across a little gem called Tidy Service:
http://www.upstartblogger.com/tidy-service-101

Sure, lots of the web editors out offer some kind of markup validation or cleanup, but what excited me about this one particular is that as a service, it can be used anywhere. Sure you can use it to beef up free (but excellent) editors like Textwrangler, but to me the biggest opportunity here is cleaning up code in the browser.

Anyone who has had to suffer my endless ramblings about my CMS of choice (yes, Drupal) might be surprised to hear that like anything, Drupal does have its share of annoyances. One of them is that occasionally editing content of any complexity within a node (sort of like a page, for you non-Drupal folk who might be reading) can be frustrating, especially because tools like FCKeditor enjoy stripping out all line breaks from the HTML they edit.

Sure, you can spend the time to fix it. Turn off the line break converter in your Full HTML input format, then change your FCKeditor profile (or do the same for your visual editor of choice) to have it NOT strip out line breaks, and you've solved the worst of it. You have to remember to do that for every stinking site you develop, though, even though you might only have a single page in one out of every five or six sites that's actually any significant issue.

<tangent>The real fix, though, should be a system that allows visual editors to define their own input formats, so that when you're using a visual editor the input format and the allowed tags of the editor, for example, are always in perfect alignment. Sorry, rant over.</tangent>

The cool thing with Tidy Service is that you can quickly make sense of a big ugly jumble of HTML with just a couple of clicks. You can also have it strip out bad tags and properties (yes, I'm looking at you, content-pasted-from-Word) and add indenting, plus it can fix any structural issues like overlapping or unclosed tags.

For my money, it's definitely worth the price of admission, which is, well, nothing. Yes, it's free so give it a try:
http://www.pixelfreak.net/tidy_service/

One caveat: HTML Tidy, which is the core of Tidy Service, was written to validate entire documents, so it has a habit of wrapping your content in a full document structure, which is a bit annoying, especially for the use case I've talked about. The solution is to create your own configuration file, which allows you to change that, plus generally wander down the rabbit hole of web geekery that is the full set of HTML Tidy options:
http://tidy.sourceforge.net/docs/quickref.html

This document describes how to set up your configuration file:
http://www.pixelfreak.net/tidy_service/readme.html

Oh, and for the lazy among you who just want to get this working as quickly as possible, the option to fix the automatic addition of an enclosing page structure is:
show-body-only: yes

Happy coding!

Comments

Powered by Drupal, an open source content management system