Tag Archives: wordpress

ColdFusion Brush for SyntaxHighlighter Plus and Evolved

SyntaxHighlighter Plus has been replaced by SyntaxHighligher Evolved. Instructions for adding a ColdFusion brush to both are below.

SyntaxHighlighter Plus is a great WordPress plugin for highlighting code in your blog posts. Out of the box it doesn’t come with a brush for ColdFusion syntax highlighting. A brush is a javascript file that is used by SyntaxHighlighter Plus to determine how to style the code inside the syntax highlighter itself. You could use the HTML brush for ColdFusion code, but a little funkiness happens at times so I added my own brush for ColdFusion.

How to Add the Brush

For Plus and Evolved, add the shBrushColdFusion.js to the scripts folder. If you installed it as a WordPress plugin, the folder structure will be syntaxhighlighter-plus (Plus) or syntaxhighlighter (Evolved), syntaxhighlighter, scripts.
SyntaxHighligher Plus: Modify the syntaxhighlighter.php found in the syntaxhighlighter-plus folder by adding ‘ColdFusion’ => array(‘coldfusion’, ‘cf’), to the aliases array.

$this->aliases = apply_filters( 'agsyntaxhighlighter_aliases', array(
            'Bash'      => array('bash', 'sh', 'shell'),
            'ColdFusion' => array('coldfusion', 'cf'),
            'Cpp'       => array('cpp', 'c', 'c++'),
            'CSharp'  => array('c#', 'c-sharp', 'csharp'),
            'Css'     => array('css'),
            'Delphi'  => array('delphi', 'pascal'),
            'Diff'    => array('diff', 'patch'),
            'Groovy'  => array('groovy'),
            'Java'    => array('java'),
            'JScript' => array('js', 'jscript', 'javascript'),
            'Perl'    => array('perl', 'pl'),
            'Php'     => array('php'),
            'Plain'   => array('', 'plain', 'text'),
            'Python'  => array('py', 'python'),
            'Ruby'    => array('rb', 'ruby', 'rails', 'ror'),
            'Scala'   => array('scala'),
            'Sql'     => array('sql'),
            'Vb'      => array('vb', 'vbnet', 'vb.net'),
            'Xml'     => array('xml', 'html', 'xhtml', 'xslt'),
        ) );

SyntaxHighligher Evolved: Modify the syntaxhighlighter.php found in the syntaxhighlighter folder by adding a registration for the brush in function _construct().

wp_register_script( 'syntaxhighlighter-brush-coldfusion',       plugins_url('syntaxhighlighter/syntaxhighlighter/scripts/shBrushColdFusion.js'),       array('syntaxhighlighter-core'), $this->agshver );

Add ColdFusion to the list of aliases.

'coldfusion'    => 'coldfusion',
'cf'            => 'coldfusion',

How to Use the ColdFusion Brush

Wrap the code you want to display in your post using one of the following methods:

[sourcecode language=’coldfusion’]code here[/sourcecode]
[sourcecode language=’cf’]code here[/sourcecode]
[coldfusion]code here[/coldfusion]
[cf]code here[/cf]

Personally I like the last method the best.


ColdFusion brush javascript code (change extension to .js before uploading)