Hey bloggers, insert code snippets in your posts !

You wonder how to to add nice code snippets in your blog posts ?
I have configured this blog to insert snippets (following this article):
http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html

The good tool used is SyntaxHighlighter:
http://alexgorbatchev.com/SyntaxHighlighter/

All you have to do now is to insert your code in your post using the following <pre> TAG (in HTML mode):

// Comment
<pre class="brush: csharp">// Comment
public class Testing {
public Testing() {
}
 
public void Method() {
/* Another Comment
on multiple lines */
int x = 9;
}
}
</pre>


Note that if your code contains '<' or '>' characters, you will need to encode it into HTML format, using a tool like this one:

http://www.opinionatedgeek.com/dotnet/tools/htmlencode/encode.aspx

Enjoy and write new posts !

Comments

Popular posts from this blog

EMGU with Xamarin Forms guide [part 1]

Xamarin.Forms device unique ID...

[Xamarin Forms] Custom bottom bordered entry (iOS & Android)