Tuesday, 22 May 2007

Using code in your blogs (blogger.com)

Not sure if everyone is aware of this, but the easiest way to blog code snippets in html on blogger.com is to put the code between <pre> tags, this applies a coding style and preserves whitespace (so you don't have to use &nbsp;). So to get this:
public void Go
{
   // TODO : Do some work    
}
Blog with the following html:
<pre>
public void Go
{
   // TODO : Do some work    
}
</pre>
Remember if you are using <tags> you need to use &lt; as the opening tag bracket otherwise the tag will be omitted (because the browser tries to parse it). Happy blogging! :)

4 comments:

Ian Dykes said...

Cool!

Didn't know that, thanks

Adam said...

Marvellous, thank you.

ecommercewebmaster12 said...

As soon as you set up your online business, you would definitely come across the challenge of surviving in a quickly growing competitive environment. Moreover, the ever-changing market trends would also pose challenges to you and at such a situation, efficient ecommerce solution may provide you the best business advantage that you can ever dream of. Come in touch with http://www.infyecommercesolution.com and avail of the best ecommerce solutions.

Semele said...

You write very well.