Posting source code on blog

While doesn’t allow you to use potentially dangerous code on your blog, there is a way to post source code for viewing. has created a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:

  1. #button {  
  3. font-weightbold;  
  5. border2px solid #fff;  
  7. }  

Wrap your code in these tags:

[sourcecode language=’css’]

your code here


Any of the following can be used for the language parameter (using one is required):

  • cpp
  • csharp
  • css
  • delphi
  • html
  • java
  • jscript
  • php
  • python
  • ruby
  • sql
  • vb
  • xml

Code in between the [sourcecode] tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

Alex Gorbatchev’s syntaxhighligher Google Code project was used to implement this feature.

%d bloggers like this: