The HLJS handler is based on HLJS (highlight.js). It lets you incorporate a syntax-highlighted external file into a presentation with a tag having one of the following forms:
<a class="hl_lang" href="file_url"/>or
<object class="hl_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.
HLJS supports many languages. All of the languages are listed in the "Languages" menu item.
The integration of HLJS 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/highlight/highlight.pack.js"/>
HLJS 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/highlight/styles/theme_name.css"/>
The HLJS web site has a demonstration page that can display a variety of languages in all of the available themes.
The "Complete Example" menu item shows actual XHTML code with examples of the style theme link, the HLJS script reference and the <a> tag .
Like the include handler, the HLJS handler only accepts content from the same server.
This is just an abbreviated list of the languages supported by highlight and it omits aliases. For a complete list with aliases see the highlight.js CSS classes reference.
Language | <a> Tag Class |
---|---|
Bash | hl_bash |
C | hl_c |
C++ | hl_cpp |
C# | hl_csharp |
Clojure | hl_clojure |
CMake | hl_cmake |
CSS | hl_css |
Delphi | hl_delphi |
Diff | hl_diff |
Erlang | hl_erlang |
DOS | hl_dos |
Groovy | hl_groovy |
Haml | hl_haml |
Haskell | hl_haskell |
HTML, XML | hl_html |
Java | hl_java |
JavaScript | hl_javascript |
JSON | hl_json |
Language | <a> Tag Class |
---|---|
Lisp | hl_lisp |
Makefile | hl_makefile |
Mathematica | hl_mathematica |
Matlab | hl_matlab |
Ocaml | hl_ocaml |
Objective C | hl_objectivec |
Perl | hl_perl |
PHP | hl_php |
Python | hl_python |
Ruby | hl_ruby |
Scala | hl_scala |
SCSS | hl_scss |
Smalltalk | hl_smalltalk |
SQL | hl_sql |
TeX | hl_tex |
VB.Net | hl_vbnet |
VBScript | hl_vbscript |
arta | ascetic | atelier-dune.dark | atelier-dune.light |
atelier-forest.dark | atelier-forest.light | atelier-heath.dark | atelier-heath.light |
atelier-lakeside.dark | atelier-lakeside.light | atelier-seaside.dark | atelier-seaside.light |
brown_paper | codepen-embed | color-brewer | dark |
default | docco | far | foundation |
github | googlecode | hybrid | idea |
ir_black | kimbie.dark | kimbie.light | magula |
mono-blue | monokai | monokai_sublime | obsidian |
paraiso.dark | paraiso.light | pojoaque | railscasts |
rainbow | school_book | solarized_dark | solarized_light |
sunburst | tomorrow | tomorrow-night-blue | tomorrow-night-bright |
tomorrow-night | tomorrow-night-eighties | vs | xcode |
zenburn |
A few examples here gives you an idea what the HLJS highlighting looks like. The text for the <a> tag is shown above the result that you get in a jsLib presentation.
The HLJS examples shown here are all displayed with a default 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/highlight/styles/default.css"/>
The HLJS handler detects three kinds of errors: