shBrushBash.js
as it wasn't formatting file redirect characters (>, <) correctly.
This is how you can upgrade too:
1. Download SyntaxHighlighter v2.0You can download it here.
If you don't have a place to upload, you can link to my free hosted version here. 2. Link to CSS and Javascript
Open your webpage's HTML file and add links to the SyntaxHighlighter's CSS and JavaScript files. For optimal results, place these lines at the very end of your page, just before the closing body tag.
<link type="text/css" rel="stylesheet" href="http://sites.google.com/site/fahdshariff/syntaxhighlighter/styles/shCore.css"></link> <link type="text/css" rel="stylesheet" href="http://sites.google.com/site/fahdshariff/syntaxhighlighter/styles/shThemeDefault.css"></link> <script type="text/javascript" src="http://sites.google.com/site/fahdshariff/syntaxhighlighter/scripts/shCore.js"></script> <script type="text/javascript" src="http://sites.google.com/site/fahdshariff/syntaxhighlighter/scripts/shLegacy.js"></script> <script type="text/javascript" src="http://sites.google.com/site/fahdshariff/syntaxhighlighter/scripts/shBrushBash.js"></script> <script type="text/javascript" src="http://sites.google.com/site/fahdshariff/syntaxhighlighter/scripts/shBrushJava.js"></script> <script type="text/javascript" src="http://sites.google.com/site/fahdshariff/syntaxhighlighter/scripts/shBrushXml.js"></script> <script type="text/javascript" src="http://sites.google.com/site/fahdshariff/syntaxhighlighter/scripts/shBrushSql.js"></script> <script type="text/javascript"> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://sites.google.com/site/fahdshariff/syntaxhighlighter/scripts/clipboard.swf'; SyntaxHighlighter.all(); dp.SyntaxHighlighter.HighlightAll('code'); </script>It is not necessary to add the js files for all languages - just for the ones you will be using. 3. Add Code
Now add the code you wish to highlight in your webpage, surrounded by the
<pre>
tag. Set the class
attribute to the language alias e.g. brush:java
:
<pre class="brush: java; gutter: false;"> public void printHello(){ System.out.println("Hello World"); } </pre>4. View Page
View the webpage in your browser and you should see your syntax highlighted code snippet. Links:
SyntaxHighlighter Home Page
Syntax Highlighting Code in Webpages (with SyntaxHighlighter 1.5)
All I can say is Thanks!
ReplyDeleteThanks, I was looking for a simple example and just found it.
ReplyDeleteThis is excellent. Thanks!
ReplyDeleteBTW, have you tried version 3? It seems to include a "?" link asking for donations. Any idea how to remove it?
How to link it with text area ?
ReplyDelete