How to use syntaxhighlighter v3.0.83 on blogger

The previous version of syntaxhighlighter uses flash to render the code, but in this version they are only using javascript.

Here's how I integrated syntaxhighlighter to this blogger blog.

Sample Source Code

<pre class="brush: java">
public static void main(String args[]) {
void helloWorld() {
System.out.println("Hello World!);
}
}
</pre>


What needs to be included, I used syntaxhighlighter hosted files:
Make sure to add these files before the </body> tag.

<!-- syntax highlighter -->
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js' type='text/javascript'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<!-- /syntax highlighter -->

<!-- Add-in Script for syntax highlighting -->
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>
How to use syntaxhighlighter v3.0.83 on blogger How to use syntaxhighlighter v3.0.83 on blogger Reviewed by Edward Legaspi on Wednesday, November 24, 2010 Rating: 5

No comments:

Powered by Blogger.