SyntaxHighlighter 3.0.83

Fork Me On GitHub
whats new?
SyntaxHighlighter is an open source Java Script client side code syntax highlighter.
donate download installation autoloader configuration @syntaxhighlight

Dynamic Brush Loading

SyntaxHighlighter comes with almost 30 brushes out of the box. One of the most requested feature has been the ability to dynamically load them without having to load them all on the same page.

Version 3 addresses this problem with with the new autoloader script. Setting autoloader up is as simple as adding shAutoloader.js file to your page and telling autoloader where your brushes are. In fact, this site is using the autoloader. Have a look at the example below:

Now any code blocks which use js, jscript, javascript and applescript brushes will trigger dynamic loading of the appropriate JavaScript file.

API

SyntaxHighlighter.autoloader(brushes)

brushes
Array: [ 'alias1 alias2 /full/path/to/brush.js', ... ] Array of space separated strings where all values but the last one are brush aliases and the last value is a full path the JavaScript file.
brushes
Array: [ [ 'alias1', 'alias2', '/full/path/to/brush.js' ], ... ] Array of strings where all values but the last one are brush aliases and the last value is a full path the JavaScript file.

This site is using the autoloader which is set up like this:

Example