Format HTML, Javascript nicely???

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Format HTML, Javascript nicely???

Post by alex.barylski »

Edit: I should also note that it NEEDS to be written in native PHP (4 or less) or Javascript...no C libraries or PHP extensions, etc...please

Edit: After a quick search on google...I've realized I'll likely have to say JUST HTML and NOT PHP. I need something written in Javascript or PHP which beautifies ONLY HTML and Javascript (would be nice).

Anyone know fo any PHP or preferably Javascript code which would take a massive string of HTML and Javascript, CSS, etc...

And format it nicely with indentation, etc?

I'm looking for something I can use it in a commercial app without restrictions so long as the source doesn't change.

Thanks a bunch :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Isn't that what PHP's tidy_...() functions are for?

http://uk2.php.net/tidy
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Yup...didn't realize PHP had a binding for it though :oops:

Only problem with that is...you need libtidy installed...I hate dependancies like that...

Cuz my software will be likely run on bare bones machines...shared servers without all the bells and whistles...

I'll use it anyway :)

Cheers
Post Reply