Syntax highlighting is very important when we want to show our code example on the Drupal site. It may be useful in the portfolio, if you’re a programmer or in blog posts to highlight pieces of code.
This module integrates JQuery syntax Highlight plugin into Drupal for syntax highlighting of source code snippets in any Drupal contents.
Please feel free to check out and use our Drupal Highlighting module.
Third party library dependency
This module requires JQuery syntax Highlight plugin which was written before. By defalut this library is included in the module installation.
But you can also download the latest version from JQuery syntax Highlight plugin page and copy it into the module folder.
Language Support
Highlighting module supports the same languages as the original JQuery plugin: HTML, CSS, PHP and Javascript.
How to use
Drupal 6
After installing “Highlighting” module add new input filter “Highlighter”.
To highlight your code, you should select “Highlighter” filter for the node and then just use this native formats:
<pre class="code">source code</pre>
To see more usage examples please check the original article.
Drupal 7
In Drupal 7 the module doesn’t create separate input format but adds new filter which should be enabled for input format you plan to use with highlighting the code. For example you can enable this filter for “Full Html” input format.
Demo
See Drupal 6 demo page with css, html, php, js syntax highlighted.
Download
Please use the links below for Drupal 6 and Drupal 7 versions accordingly:
Download
Version | Downloads | Date |
---|---|---|
6.x-1.0 | zip (7.13 KB) | 2010-December-19 |
7.x-1.0 | zip (7.40 KB) | 2011-June-06 |
To do
- Create admin configuration form for changing plugin options: source, zebra, indent and list