Highlight.js highlights syntax in code examples on blogs, forums and in fact on any web pages. It's very easy to use because it works automatically: finds blocks of code, detects a language, highlights it.
This is not only convenient but also allows highlighting for code examples marked up with writing syntaxes like Markdown where there is no way to specify HTML class easily.
The library knows 54 languages and is bundled with 26 style themes.
Developers and designers are welcome to take part in development.
version 7.3
News
-
13.10.2012
Version 7.3
Since this version highlight.js no longer works in IE version 8 and older. It's made it possible to reduce the library size and dramatically improve code readability and made it easier to maintain. Time to go forward!
New languages: AppleScript (by Nathan Grigg и Dr. Drang) and Brainfuck (by Evgeny Stepanischev).
Improvements to existing languages:
- interpreter prompt in Python (
>>>and...) - @-properties and classes in CoffeeScript
- E4X in JavaScript (by Oleg Efimov)
- new keywords in Perl (by Kirk Kimmel)
- big Ruby syntax update (by Vasily Polovnyov)
- small fixes in Bash
- interpreter prompt in Python (
Also Oleg Efimov did a great job of moving all the docs for language and style developers and contributors from the old wiki under the source code in the "docs" directory. Now these docs are nicely presented at http://highlightjs.readthedocs.org/.
-
27.08.2012
Version 7.2
A regular bug-fix release without any significant new features. Enjoy!
-
11.08.2012
Version 7.1
A Summer crop:
- Marc Fornos made the definition for Clojure along with the matching style Rainbow (which, of course, works for other languages too).
- CoffeeScript support continues to improve getting support for regular expressions.
- Yoshihide Jimbo ported to highlight.js five Tomorrow styles from the project by Chris Kempson.
- Thanks to Casey Duncun the library can now be built in the popular AMD format.
- And last but not least, we've got a fair number of correctness and consistency fixes, including a pretty significant refactoring of Ruby.
-
05.06.2012
Version 7.0
The reason for the new major version update is a global change of keyword syntax which resulted in the library getting smaller once again. For example, the hosted build is 2K less than at the previous version while supporting two new languages.
Notable changes:
The library now works not only in a browser but also with node.js. It is installable with
npm install highlight.js. API docs are available on our wiki.The new unique feature (apparently) among syntax highlighters is highlighting HTTP headers and an arbitrary language in the request body. The most useful languages here are XML and JSON both of which highlight.js does support. Here's the detailed post about the feature.
Two new style themes: a dark "south" Pojoaque by Jason Tate and an emulation of XCode IDE by Angel Olloqui.
Three new languages: D by Aleksandar Ružičić, R by Joe Cheng and GLSL by Sergey Tikhomirov.
Nginx syntax has become a million times smaller and more universal thanks to remaking it in a more generic manner that doesn't require listing all the directives in the known universe.
Function titles are now highlighted in PHP.
Haskell and VHDL were significantly reworked to be more rich and correct by their respective maintainers Jeremy Hull and Igor Kalnitsky.
And last but not least, many bugs have been fixed around correctness and language detection.
Overall highlight.js currently supports 51 languages and 20 style themes.
-
07.04.2012
Version 6.2
A lot of things happened in highlight.js since the last version! We've got nine new contributors, the discussion group came alive, and the main branch on GitHub now counts more than 350 followers. Here are most significant results coming from all this activity:
- 5 (five!) new languages: Rust, ActionScript, CoffeeScript, MatLab and experimental support for markdown. Thanks go to Andrey Vlasovskikh, Alexander Myadzel, Dmytrii Nagirniak, Oleg Efimov, Denis Bardadym and John Crepezzi.
- 2 new style themes: Monokai by Luigi Maselli and stylistic imitation of another well-known highlighter Google Code Prettify by Aahan Krish.
- A vast number of correctness fixes and code refactorings, mostly made by Oleg Efimov and Evgeny Stepanischev.