Writing Custom Brush
Just installed Creative Syntax Highlighter and it works great for standard stuff. Now I need to write a custom brush for a strange language.
I've done my homework and found several tutorials on writing a custom brush. I followed the instructions and wrote one but it's not working. On page load it says "Can't find brush: custom".
Here is what I'm doing. To simplify things without funny business, rather than showing my custom code, let me copy the existing shBrushRuby.js file, call it shBrushRubyAbc.js file. So we know that code works, and is for a new dummy language called RubyAbc.
In that file I modify only these lines:
Brush.prototype = new SyntaxHighlighter.Highlighter(); Brush.aliases = ['ruby', 'rails', 'ror', 'rb']; SyntaxHighlighter.brushes.Ruby = Brush;
Brush.prototype = new SyntaxHighlighter.Highlighter(); Brush.aliases = ['rubyabc']; SyntaxHighlighter.brushes.RubyAbc = Brush;
So far so good. Next, I notice that in shInit.js there is a declaration for each shBrushXXX.js file, so let me add our new one in below the existing entry for Ruby:
"ruby rails ror rb @shBrushRuby.js", "rubyabc @shBrushRubyAbc.js",
Save, upload both files to the respective folder, Disable and re-Enable the Creative Syntax Highlighter for good measure, and load a page containing this code:
<pre class="brush: ruby">Some ruby code</pre>
That works. But this doesn't work (it says "can't find brush: rubyabc"):
<pre class="brush: rubyabc">Some ruby code</pre>
What am I missing?