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 isn't obvious is that we had
to do a tremendous amount of work to get HTML Tidy to play well with ASP.NET
controls but even with all the work we did it still won't format certain ASP.NET
Since ASP.NET tags are not part of the HTML specification it is necessary to
provide Tidy with a list of new tags and how they should be formatted. Tidy has
several options allowing you to control how new tags are formatted using
either block, inline, empty or pre. In C#Builder and Delphi 8.0 we automatically discover
any ASP.NET tags within an .aspx page and prepopulate these settings prior to
formatting allowing Tidy to format the ASP.NET tags as it would any standard
tag. There are lots of ASP.NET tags and subtags and without this feature it
would be incredibly tedious to try and use HTML Tidy to format ASP.NET
One problem however is that some ASP.NET
tags support templates, meaning that they can contain fragments of HTML
which should not be modified during the formatting process. Unfortunately, HTML
Tidy has no way to deal with ASP.NET templates and will in fact reformat the tag
and completely change it's meaning. As you can imagine this is not a good
situation and unfortunately there is no workaround.
HTML Tidy does provide support for various web scripting languages like PHP
and ASP and I think as the popularity of ASP.NET grows that it would be great
if HTML Tidy could provide support for it too. If the support can't be built
into HTML Tidy then there needs to be some alternative whether it's a callback
or some other mechanism that would allow the developer to improve Tidy's ability
to deal with tags that it's not familiar with.
Over the past year and a half I've have seen a handful of requests for Tidy
to support ASP.NET but unless more people speak up and voice their opinion I'm
afraid it will be a long time before that will happen.
Here's where you come in, if you'd like to see this situation improve please
visit the HTML Tidy website, get
involved either by asking the great set of developers who keep this code base
alive to support ASP.NET or by grabbing the code, diving in and adding it
yourself (of course read all of the guidelines before doing that).
While you're there also make a case for separating how HTML Tidy options are
passed so that things like the Borland IDE's aren't tied to the Tidy config file
format. I'd really like to see the command like option handling separated so
that IDE's can load options from whereever they store them whether it's the
Windows registry or an INI file or whatever.
A few other notes, I'd like to thank the people who work on HTML Tidy for all
of their effort. They do a great job and have been very helpful and responsive
whenever I've had questions. Additionally, I'd also like to point out that we
Pohlmeyer's TidyPas Pascal interface. Btw, both of these are mentioned in
our IDE's Help | About box.
[Updated Dec 29 2004] Added link with additional information
on ASP.NET page templates.
[Updated March 29, 2005] Just got a comment from Jeff
updating the link to Tidypas which I've now corrected in this post.