Monday, June 25, 2012

code syntax highlighting in blog posts


Problem: Need to syntax highlight the code in the blog posts (to improve it's readability).
Solution: github's gist (http://gist.github.com/)

OK now what's the story? I tried to find some simple solution for me to be used in the blogger.com in the dynamic templates.
I've found: gist. 
As one of the quite popular proposals on stackoverflow said :
http://stackoverflow.com/questions/679189/formatting-code-snippets-for-blogging-on-blogger

What is gist?
(Copy pasted from their site) "Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository."

Sounds good. But when trying it didn't work for the blogger and dynamic templates.
After some googling found following post:
http://blog.moski.me/2012/01/gist-with-bloggers-dynamic-views.html
and that worked for me!

So since from now on, you can expect some nicely highlighted code snippets in my posts :)

No comments: