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:
paste your code here
In the above code just change the language name between ” ” in the [sourcecode language=” “] tag.
WordPress support the following languages:
matlab (keywords only)
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,
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 .