- Download the SyntaxHighlighter javascript and css files from http://code.google.com/p/syntaxhighlighter/
- Upload those to my googlepage website, if you don't have one go to https://www.google.com/accounts/ManageAccount and click on the 'Page Creator' link
- Edit the blog template -> Layout -> Edit Html
- Add the references to the css and javascript files in the head section
- Add the initialization javascript calls right before the /body tag at the end of the html template
- see http://morten.lyhr.dk/2007/12/how-to-get-syntax-highlighting-in.html
- then use pre tags like this around your code pre class="c-sharp" name="code"
- see http://code.google.com/p/syntaxhighlighter/wiki/Usage
One issue I ran into was that the google blogger automatically adds br tags where newlines appear in any content - makes the code pretty much unreadable, but the fix is well documented and easy to implement - http://code.google.com/p/syntaxhighlighter/wiki/BloggerMode
No comments:
Post a Comment