This is still under development and the API unset, but feel free to join in.
- Be tiny, fast, and accurate, therefore no language detection and stuff.
- Work client or server side
- Extend popular libraries with it (MooTools, jQuery, dojo)
- Extend not-so-popular libraries with it (snack, ender)
Regex matching is based on textmate languages, therefore a regex can have multiple captures (might even be scriptable to convert any .tmLangauge into a HiliteJS language /shrug).
(c) Ryan Florence, MIT Style License
Many thanks to hijs for a few bits of inspiration.
Subject to change! Check out the demo.
You should pretty much just be using CODE tags and CODE tags wrapped in a PRE.
Adds highlighting to an element.
hilite(node, language, lines)
- node (dom element) - the element w/ code to highlight
- language (string) - the language to use, if undefined, will look at the
data-languageattribute of the element
- lines (boolean) - defaults to false, inserts line numbers if true. If the tag's parent is a PRE element, this defaults to true.
Converts a string of text to a string of text w/ SPAN tags all over the place. Ideal for SSJS.
- text (string) - the text to convert
- language (string) - the language to use
String, with SPANS all over the place.
Defines a language
src/languages for now, it's pretty basic.