Syntax Highlighting with Blogger Engine

I was trying to style the code snippets highlighted as code as developer in my blog. Did it using some custom css but no positive impression. Recently googling, found an article abt that here.

This can be done using syntaxhiglighter.

Drop this code right before your </head> tag...

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



and save.
And here is the way how you can use it.

1. Using <script> tag with CDATA


This will output....

// Commenting this function
function custom_one($var) {
  if($one == $two) {
    $three = array(
      'one',
      'two'
    );
  }
}


2. Using the <pre> tag.

// Commenting this function
function custom_one($var) {
if($one == $two) {
$three = array(
'one',
'two'
);
}
}
This will output....
// Commenting this function
function custom_one($var) {
  if($one == $two) {
    $three = array(
      'one',
      'two'
    );
  }
}


Comments

  1. This is what exactly working here right now. Will you double check your settings?

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Reset Root Password in Drupal 7 with phpMyAdmin