Welcome! » Log In » Create A New Profile

Nice source code output

Posted by Mike 
Mike
Nice source code output
May 24, 2008 04:12PM

When you click show web source in the browser it is nice to have well-formatted code (mostly it`s all about: \t and \r\n). Does HTML Purifier supports such kind of formatting?

I.e. I'd like to see (when I check source of the page):

<body>
   <ul>
      <li>test</li>
      <li>test</li>
   </ul>

instead of:

<body>
<ul><li>test</li><li>test</li></ul>

If this feature isn't supported, are there any plans to do so in future releases?

Edited 1 time(s). Last edit at 05/24/2008 04:15PM by Ambush Commander.

Re: Nice source code output
May 24, 2008 04:15PM

See %Output.TidyFormat. Although I can't say that I recommend this: ideally, Tidy should be run on the whole page, not just the parts validated by HTML Purifier.

Mike
Re: Nice source code output
May 25, 2008 04:10AM

So you recommend using both HTML Purifier for let`s say textarea input to filter data where html tags are allowed and Tidy for everything including textarea just to make code more tidier?

Using both scripts may may cause some performance problem. Have you ever tested or made any benchmarks for this solution?

Thanks for help, Ambush

Re: Nice source code output
May 25, 2008 11:10AM

Yes, and yes. The performance of HTML Purifier is highly dependent on your PHP setup, but it's a safe bet to say that you should be caching its output. Tidy, I don't really have a good answer for, except don't use it!

BTW, HTML Purifier should be largely preserving any spaces in your source code. If it isn't, you might want to set %Core.LexerImpl to DirectLex.

Sorry, you do not have permission to post/reply in this forum.