Skip to main content

Posts

Showing posts from September, 2011

Insert code snippets in Blogger using Prettyfy

If you want to insert code snippets with syntax-highlighting in your blogs on Blogger.com, then you can use google-code-prettify . There are other syntax highlighting solutions out there, but this allows to do this very simply. The steps are: Click on "Theme" (in LHS of blogger home page) or "Design" (in upper RHS corner). Click on "Edit HTML" button. Search for <head> tag in the html. Insert following line after meta tags in head tag: <script src='https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?lang=scala&amp;lang=yaml&amp;lang=bash&amp;lang=xml&amp;lang=sql&amp;skin=sons-of-obsidian' type='text/javascript'></script> For me it is just before <title> tag. Add onload property to <body> tag: <body class='container' onload='prettyPrint()'> Here I have used " Sons-Of-Obsidian " style, you can use any of the available themes .