Following on from Scott Hanselman's post about the SyntaxHighlighter script, here's the secret sauce I needed to get it to work.
The separate hosting is the easy bit -- the trick was getting the code I needed to run the repainting into a window.onload, and to keep Blogger from mutilating the code by use of a CDATA section.
Et voilà!
<link href='.../SyntaxHighlighter.css' rel='stylesheet' type='text/css'/> <script src='.../shCore.js' type='text/javascript'/> <script src='.../shBrushPython.js' type='text/javascript'/> <script src='.../shBrushRuby.js' type='text/javascript'/> ... <script type='text/javascript'>//<![CDATA[ window.onload = function () { dp.SyntaxHighlighter.ClipboardSwf = ".../clipboard.swf"; dp.SyntaxHighlighter.BloggerMode(); dp.SyntaxHighlighter.HighlightAll("code",true,false,false,1,false); } //]]></script>
There is also a Scala brush for this -- but F# or Erlang will need to be hand-cranked first.
Later: hand cranking done & linked.
No comments:
Post a Comment