Saturday, February 7, 2009

Syntax highlighting and source code publishing in Blogger

Been trying to publish some JavaScript Code in blogger and not having much fun so I found these two links which may be useful. which provides syntax highlights. which converts your code into escaped code for publishing. This item links to his code converter at
Update:Just posted a blog on Ubiquity and created a new verb to do this.

It took me a bit to get the syntax highlighter working as the Blogger template editor kept converting the quotes in the last javascript to ' which was a pain, so I got around it by having those two lines in another script file on my server. I think you also have to load the specific JS files for each type of code you need.

Here is my test code for highlighting

<script type="text/javascript">
alert('test syntax highlighter');

echo 'test syntax highlighter';