Here is another way to paste code into blogger with nice syntax highlighting.
- Go to http://gist.github.com
- Past the code you want to post
- Copy the embed tag
- Go back to blogger, and select "Edit Html"
- Paste the embed tag into your post
Below is the example source code using this tag: <script src="http://gist.github.com/467670.js?file=gistfile1.sql"></script>
A potential drawback of this approach might be the stability of github as a company. In a downturn, it may shut down with very short notice.
Compare to using SyntaxHighlighter, personally, I think this approach is way better:
- No setup required (in a previous post I documented how to setup syntaxhighlighter for blogger, it took me half an hour to setup everything correctly. Now with gist, there is zero setup required );
- Faster to create code snippet in a post;
- Supports more languages;
- No need to worry about pasting XML, HTML, or other special characters;
To paste script like below used to require replacing '<' with < and '>' with > manually. Now is simply copy paste without any manual changes: