Friday, May 13, 2016

Blogger syntax higlighting

Attention:
Do not use a dynamic template. Syntax highlighting won't work.
http://stackoverflow.com/questions/12464924/blogger-syntaxhighlighter-doesnt-work-at-all
From the above:

I had the same problem. The instructions to set up SyntaxHighlighter seemed easy enough. And all tutorials were more or less comparable including the comment "on my blog it works, if it doesn't work for you then you must be doing something wrong". Nothing worked for me, I got no highlighting.

The solution was to switch to another Blogger template. It just didn't work with the dynamic template I chose. Switching to a simple template did the trick. Highlighting now works.

By the way: While chasing for errors I also tried Prettify as an alternative. It also didn't work. Seems like the dynamic template did something which caused both syntax highlighters to fail.

based on:

http://www.danielhansen.net/2014/06/how-to-format-code-and-syntax.html

http://oneqonea.blogspot.it/2012/04/how-do-i-add-syntax-highlighting-to-my.html

<?php
$example = range(0, 9);
foreach ($example as $value)
{
 echo $value;
}

Custom configuration:
http://alexgorbatchev.com/SyntaxHighlighter/manual/configuration/