Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML code formatter

Status
Not open for further replies.

RebLazer

Programmer
Jun 7, 2002
438
US
I'm using Visual Studio.NET and it produces somewhat ugly HTML code with lots of extra <P></P> etc.

Is there an online service that I can copy/paste my HTML code onto someone's webpage and it will return to me my HTML code formatted nicely and without all of the superfluous tags?

Thanks so much!
Lazer
 
Oh, I'm sure .net produces extraordinarily efficient code and that removing any of it is very likely to affect the security and reliability of your website. [lol]

I've had really good luck using a Microsoft product to build my web pages, combined with an online validation tool.

I use a product called &quot;notepad&quot;.

I validate at
Using software such as .net or FrontPage to build a website will usually produce lots of &quot;unnecessary&quot; code. For your application, it might be unnecessary, but for others, it isn't and none of the code-generating tools seem to be able to read minds. So, if the code bothers you that much, then using .net to build your site, well, might not be the best move for you. Write your own code. And validate it.

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
RedBlazer,

Most people in this forum will encourage you to use Notepad or any other text editor.

I personally use UltraEdit but some people in this forum can probably tell us what they prefer to use.

On a side note, using Microsoft product to create content is probably the best way to get tied in to MS only products all along the chain of delivery. Chances are the people will be forced to use IE to see your site efficiently. Why not take the more noble path and do everything in a textpad and use standard compliant efficient code all the way? Gary Haran
==========================
 
My question was not what is a good editor. It was: once you have HTML code - from wherever either hand written or otherwise - where is a site that you can throw your code into it and it will reformat it (fix indentations) and remove extra tags - <p></p> etc?

Lazer
 
RebLazer,

Maybe I wasn't clear enough on this point. There can't be such a site because, according to .net (or &quot;whatever&quot;), all the code is &quot;necessary&quot; in your listing.

If you think you have unnecessary code, then it's your job to delete it.

You can do a bulk-replace, replacing all tabs with spaces, if you just don't like indents produced from whatever tool you're using (and if you don't like how you're formatting it by hand, I recommend &quot;Hulk Hands&quot; at Toys-backwards-R-Us&quot;). You can do a bulk-replace of &quot;<p></p>&quot; >> &quot;&quot; but there's not really much of a tool out there that's exactly gonna take your breath away, if you know what I mean.

.net has no artificial intelligence -- it can't know what you think is superfluous. That requires real honest-to-gosh intelligence.

It's like a Zen koan: what does a web programmer do when they want to get rid of extra code? They don't write extra code.

Cheers,
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Now I use Dreamweaver and it has a &quot;cleanup HTML&quot; menu item, but before that I had used HTML Tidy. Maybe that can help you out.

Mickey
 
MickeyG,

Thank you for answering my question! Actually, I was thinking of something very simple - i.e. paste your HTML code on a webpage, and it will spit it back to you &quot;tidied-up&quot;.

Any ideas?

Thanks!
Lazer
 
no known scripts out there to do it, but javascript or vbscript can easily parse the pages with a simple regular expression to delete and tags in the pattern not containing something between them. _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
If DreamWeaver is similar to HTML Tidy, it WILL NOT do what you want. What HTML Tidy does is find unended tags, mismatched tags, etc. It will not fix this:
<p><p><p>text</p></p></p>

Rick -----------------------------------------------------------
RISTMO Designs
Arab Church
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top