How To Highlighted codes in drupal ?

  0 comments
Share

Highlighting the syntax in your blog or article page is easy in Drupal. There are so many modules for it, and working well. GeSHi Filter module for syntax highlighting is one of them. Which highlight your programming, scripting and mark-up languages? It shows your syntax in different colors and font according to the category of terms. Here in this blog i am showing how to configure and use it.

Step 1:

Download GeSHi Filter module.

Download Libraries API module.

Libraries API Must be 7.x-2.x version of Libraries API.

Enable above mentioned modules.

The module GeSHi Filter has dependency GeSHi (Generic Syntax Highlighter) library. so download it from http://sourceforge.net/projects/geshi/files/geshi

After downloading the library extract it and paste it into sites\all\libraries

Step 2:

Go to admin/config/content/formats/geshifilter/languages

You would see the list of enable language

geshiImg-1

To enable the more language or disable click on All tab.

Check the box of those languages which you want to enable and uncheck the box of those languages which you don't want to use.

Click on Save configuration buton.

Step 3:

Now go to admin/config/content/formats

Click the Configure link of that text format which you use. In my case i use Filtered HTML.

geshiImg-2

Check the box of GeSHi filter.

geshimg-3

Arrange the GeSHi filter in Filter processing order like below image.

geshiImg-4

Step 4:

We have configured GeSHi filter and now time to use it.

Create a piece of content with some php code.

geshiImg-5

Before your programming, scripting and markup languages code write Tag/language attribute value

As i use in my content for php

gesdhiImg8

 

For knowing more Tag/language attribute value go to admin/config/content/formats/geshifilter/languages and find it.

geshiImg6

After saving the content you would be see something like below image.

geshiImg-7

Add new comment