Using Syntax highlighter in drupal blog

Using Syntax highlighter in drupal blog Syntax highlighting is very common demand in programming related blogs. There are several modules for same task like GeSHi filter, SyntaxHighlighter etc. I find SyntaxHighlighter module very handy to display code snippet on my articles. There are two steps to make this module working.
  1. Install syntaxhighlighter library :
    #1. Download js library from http://alexgorbatchev.com/SyntaxHighlighter/download/
    #2. unzip and rename the folder from syntaxhighlighter_3.0.83 to syntaxhighlighter and paste it inside /sites/all/libraries
  2. Install syntaxhighlighter module:
    #1 Download module from https://www.drupal.org/project/syntaxhighlighter
    #2. Extract and keep it inside /sites/all/modules. Enable the module either from admin panel or from drush.
I have wrapped the code by <pre>.
<pre class="brush: php;">
/**
 * Returns all flag types defined on the system.
 *
 * @return
 *   An array of flag type names.
 */
function flag_get_types() {
  $types = &drupal_static(__FUNCTION__);
  if (!isset($types)) {
    $types = array_keys(flag_fetch_definition());
  }
  return $types;
}

</pre>
This is how it looks:
/**
 * Returns all flag types defined on the system.
 *
 * @return
 *   An array of flag type names.
 */
function flag_get_types() {
  $types = &drupal_static(__FUNCTION__);
  if (!isset($types)) {
    $types = array_keys(flag_fetch_definition());
  }
  return $types;
}

Share this post