How To: Add a Brush to SyntaxHighlighter Evolved

In this example, we will be adding the “Batch” (shBrushBat.js) brush to SyntaxHighlighter Evolved from the blog, Under My Hat.  This is also useful when you upgrade SyntaxHighlighter Evolved and need to readd brushes to your install.

  1. Download the brush from Under My Hat.
  2. Upload the file “shBrushBat.js” to your WordPress “/wp-content/plugins/syntaxhighlighter/third-party-brushes” folder.
  3. Log into your WordPress dashboard and go to the plugin editor.
  4. Select SyntaxHighlighter Evolved from your list of plugins.
  5. Edit file “syntaxhighlighter/syntaxhighlighter.php“.
  6. Search for “// Register some popular third-party brushes“.
  7. In the section of code below where you searched, add the following:
    1. wp_register_script( 'syntaxhighlighter-brush-bat',        plugins_url( 'third-party-brushes/shBrushBat.js',               __FILE__ ), array('syntaxhighlighter-core'), '20091207'     );
  8. Search for “$this->brushes = (array) apply_filters( ‘syntaxhighlighter_brushes’, array(“.
  9. In the section of code below where you searched, add the following:
    1.  'bat' => 'bat',
       'batch' => 'bat',
       'cmd' => 'bat',
      
  10. Finally, update (save) the file.
Share

Leave a Reply

Your email address will not be published.

*