original post

WordPress is providing a very simple way to post code snippets on your wordpress blog.  It provides a syntax highlighting for the code .

Just select Text Option in your post composing window, and  paste your source code between the tags as given below.

Example, posting the  csharp code:

[sourcecode language=”csharp”]
paste your code here
[/sourcecode]

In the above code just change the language name between ” ” in the [sourcecode language=” “] tag.

WordPress support the following languages:

actionscript3
bash
clojure
coldfusion
cpp
csharp
css
delphi
erlang
fsharp
diff
groovy
html
javascript
java
javafx
matlab (keywords only)
objc
perl
php
text
powershell
python
r
ruby
scala
sql
vb
xml

If the language parameter is not set, it will default to “text” (no syntax highlighting).

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

To have a sample look of this, see my another wordpress blog  www.dotnetdots.wordpress.com .

Or otherwise you can use Online Syntax Highlighting websites. We have many websites that are providing syntax highlighting . Some of them that i have used are,

1) http://quickhighlighter.com

2)  http://markup.su

3) http://tohtml.com

paste your source code in the box provided in those highlighting websites and click on highlight. Then the html code is generated . And copy the generated html code and paste in wordpress post by selecting  Text option.  

To know about the code posting on blogger, go for the post  SIMPLE WAY TO POST CODE SNIPPETS ON BLOGGER .