The SHJS handler is based on SHJS - Syntax Highlighting in JavaScript. It lets you incorporate a syntax-highlighted external file into a presentation with a tag having one of the following forms:
<a class="sh_lang" href="file_url"/>or
<object class="sh_lang" href="file_url"/>
The tag is replaced by a <pre> tag. It can be styled like tags with a html handler, but styling is usually not necessary.
SHJS supports many languages. All of the languages are listed in the "Languages" menu item.
The integration of SHJS into jsLib detects some common errors. Since it involves JavaScript other than jsLib, its use requires an additional JavaScript file in the <head> tag:
<script type="text/javascript" src="/~gshute/jsLib/shjs_all.js"/>
SHJS allows you to select among many different highlighting themes by using different style sheets in your presentation. All of the themes are listed in the "Themes" menu item. These themes can be selected by including a tag with the following form in the document's <head> tag:
<link rel="stylesheet" type="text/css" href="/~gshute/jsLib/shjs-0.6/css/sh_theme_name.css"/>
The SHJS home page has a demonstration widget that displays a simple C++ file in all of the available themes.
The "Complete Example" menu item shows actual XHTML code with examples of the style theme link, the SHJS script reference and the <a> tag .
Like the Include handler, the SHJS handler only accepts content from the same server.
Language | <a> Tag Class |
---|---|
Bison | sh_bison |
C | sh_c |
C++ | sh_cpp |
C# | sh_csharp |
ChangeLog | sh_changelog |
CSS | sh_css |
Desktop files | sh_desktop |
Diff | sh_diff |
Flex | sh_flex |
GLSL | sh_glsl |
Haxe | sh_haxe |
HTML | sh_html |
Java | sh_java |
Java properties files | sh_properties |
JavaScript | sh_javascript |
JavaScript with DOM | sh_javascript_dom |
LaTeX | sh_latex |
LDAP files | sh_ldap |
Log files | sh_log |
LSM (Linux Software Map) files | sh_lsm |
Language | <a> Tag Class |
---|---|
M4 | sh_m4 |
Makefile | sh_makefile |
Objective Caml | sh_caml |
Oracle SQL | sh_oracle |
Pascal | sh_pascal |
Perl | sh_perl |
PHP | sh_php |
Prolog | sh_prolog |
Python | sh_python |
RPM spec files | sh_spec |
Ruby | sh_ruby |
S-Lang | sh_slang |
Scala | sh_scala |
Shell | sh_sh |
SQL | sh_sql |
Standard ML | sh_sml |
Tcl | sh_tcl |
XML | sh_xml |
Xorg configuration files | sh_xorg |
acid | berries-dark | berries-light | bipolar |
blacknblue | bright | contrast | darkblue |
darkness | desert | dull | easter |
emacs | golden | greenlcd | ide-anjuta |
ide-codewarrior | ide-devcpp | ide-eclipse | ide-kdev |
ide-msvcpp | kwrite | matlab | navy |
nedit | neon | night | pablo |
peachpuff | rand01 | the | |
typical | vampire | vim | vim-dark |
whatis | whitengrey | zellner |
A few examples here gives you an idea what the SHJS highlighting looks like. The text for the <a> tag is shown above the result that you get in a jsLib presentation.
The SHJS examples shown here are all displayed with a standard theme style sheet. This theme can be selected by including the following tag in the document's <head> tag:
<link rel="stylesheet" type="text/css" href="/~gshute/jsLib/shjs-0.6/sh_style.css"/>
The SHJS handler detects three kinds of errors: