devxlogo

Pretty Print Your HTML and ASP Code for Visitors

Pretty Print Your HTML and ASP Code for Visitors

If you are preparing Active Server Pages code for printing or for code review it helps to make the script as tidy as possible. A free utility called HTML Tidy from http://www.w3.org/People/Raggett/tidy/ does an excellent job of putting HTML in order. Unfortunately, Tidy doesn’t preserve ASP code. For example, it converts ASP delimiters into HTML escape codes so that <% turns into <%. However, if you make a backup and then note the conversions, you can use your editor's Search and Replace feature to reverse key changes and get back your ASP code. Just replace < with < and so on. In addition to the delimiters, watch for changes to the ampersand (&).

HTML Tidy runs from the command prompt. Here’s the contents of a batch file called dotidy.bat:

 tidy -i -m -u -raw -f  errors.txt -wrap 200 %1

Call the batch file by passing the filename to it as in:

 dotidy.bat myfile.asp

I’ve asked the author of HTML Tidy to add a switch that protects ASP code. Perhaps additional requests at his Web page will provide an incentive.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist