HighlightJS

Let me introduce my first module for Drupal that I decide make public -
HighlightJS. It's based on js script highlight.js by Ivan Sagalaev. For a while module will be available from svn
This is lightweight module that takes less server and client resources than common GeSHi module for Drupal. It's extremely small and loads only when you really need it
[code class="php"]
<?php
print "Hello World!";
?>
[/code]
Installation is standard as for any another Drupal module:

  • copy (check out from svn) folder to sites/all/modules (sites/example.com/modules if you use multisiting)
  • activate module from admin

Default highlight script highlight.js placed in module folder, but you can choose another version of highlight.js (for example when new version will be available). You can set it in Admin > Settings > HightlightJS
When module installed, in "Input formats management" ( Admin > Setings > Input formats) appears filter "Highlight code". This filter searches in node blocks [code class="lang"]...[/code] and highlight it. You can choose preloaded languages and css stylesheet. Important note: when you add "Highlight code" to input format check how it placed regarding to other filters . "Highlight code" must stay after "HTML filter" but before "Line break converter"
In next version i plan to automatize this part of installation process and create input formats "Filtred HTML with code highlight" and "Full HTML with code highlight" during module activation