auto load syntax higlighter

Topics: Controls
Feb 8, 2011 at 3:36 PM

The new v3 of syntax highlighter supports auto loading brushes. Would be great to have this feature. This load brushes only if its present in the page, if it is not present it doesn't load it.

function SyntaxHighlighterPath(){  
	var args = arguments,result=[];
	for(var i = 0; i < args.length; i++)
		result.push(args[i].replace('@', 'http://s.prabir.me/js/syntaxhighlighter/3_0_83/scripts/'));
	return result
};
SyntaxHighlighter.autoloader.apply(null, SyntaxHighlighterPath('applescript @shBrushAppleScript.js','actionscript3 as3 @shBrushAS3.js','bash shell @shBrushBash.js','coldfusion cf @shBrushColdFusion.js','cpp c @shBrushCpp.js','c# c-sharp csharp @shBrushCSharp.js','css @shBrushCss.js','delphi pascal @shBrushDelphi.js','diff patch pas @shBrushDiff.js','erl erlang @shBrushErlang.js','groovy @shBrushGroovy.js','java @shBrushJava.js','jfx javafx @shBrushJavaFX.js','js jscript javascript @shBrushJScript.js','perl pl @shBrushPerl.js','php @shBrushPhp.js','text plain @shBrushPlain.js','py python @shBrushPython.js','ruby rails ror rb @shBrushRuby.js','sass scss @shBrushSass.js','scala @shBrushScala.js','sql @shBrushSql.js','vb vbnet @shBrushVb.js','xml xhtml xslt html @shBrushXml.js'));SyntaxHighlighter.all();

More information on this can be found at http://alexgorbatchev.com/SyntaxHighlighter/manual/api/autoloader.html

I use this auto load method in my blog at http://blog.prabir.me/ but would be great to have it inbuilt in BE.