To get the highlighter to work, you need to add some script and styles to your blog template. There are nice folks out there who did this work already, you can find one here.
Unfortunately for dynamic view templates like this one on Blogger, it does not work. There is a workaround though, that is to call the highlighter when the page is loaded. The code below highlights anything that has the right class attribute for SyntaxHighlighter library, independent of the name attribute. Which makes it nicer when you have multiple code snippets on a page.
You don't even have to add this to your template. Just make sure you add it to the bottom of your post using the HTML view on Blogger (not the Compose view). As you can see here, it works. It took me some time to discover that the dynamic views are rendered differently. Most instructions before that were irrelevant. Hope you stumble into this note faster than it took me to find this information.
Post a Comment