[wp-hackers] Outputting Clean Well Indented and Readable X/HTML
Nathan Rice
ncrice at gmail.com
Mon Mar 14 16:59:55 UTC 2011
A more ideal solution would be to write a plugin to do Dougal said, but pair
that with a caching plugin, so the markup output only needs to be tidied up
once.
But you'd need to check out the WP-Super-Cache plugin to make sure your tidy
script runs before the cache is generated. It might be worth checking out
other caching plugins too.
But, the downside to this is that all those linebreaks and tabs do add up to
a larger filesize when users access your site. You could potentially be
adding 10-20% download times by doing it your way. I'd run Google Page Speed
or YSlow to see what, if any, negative effects having tidy HTML actually
adds, and weight it against the positive effects.
------------------
Nathan Rice
WordPress and Web Development
www.nathanrice.net | twitter.com/nathanrice
On Mon, Mar 14, 2011 at 12:51 PM, Kevin Newman <CaptainN at unfocus.com> wrote:
> Personally, I don't concern myself with clean output, and prefer it be as
> small and tight as possible for reduced payload size.
>
> Every major browser now comes with tools (or have them available) that show
> you a live collapsible view of the HTML - very rarely do I ever need to look
> and see what the raw html looks like since I spend my time looking at these
> tools - even then though, you can get the HTML of a selection pretty easily,
> which reduces the amount of HTML you need to sift through enough that it can
> be pretty messy, and you'll do fine.
>
> The thought of going back 5 years to a time when firebug didn't exist, is
> enough to give me nightmares.
>
> Kevin N.
>
>
>
> On 3/7/11 3:34 PM, Alex Andrews wrote:
>
>> Dear all,
>>
>> Looking at the raw HTML for a site I'm working for, its really
>> horribly formatted. There is just so much unnecessary whitespace and
>> bad indenting. It makes it very difficult to work out what is going
>> on, and occasionally what is going wrong.
>>
>> How do other people cope with this? I know there are a few plugins,
>> but they don't seem to format HTML 5 well. HTML Tidy module for PHP is
>> unavailable on my server. How can one:
>>
>> 1. Use plugins to make HTML output from Wordpress look best.
>> 2. Have best practices for programming PHP in Wordpress to solve this
>> problem?
>>
>> Thanks for all your help.
>>
>> All the best.
>>
>> Alex
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list