I didn’t want to use a jQuery plugin. Because I needed something small, that would load fast and did not show the flash of un-styled lines of code, or kept the flash, to a minimum.
This is a list, and not a review. A review may be coming up in an another post.
- Rainbow: Small, lightweight library for syntax highlighting. Minified the core is about 1.4kb. Each additional language adds about 1-3kb.
- Snippet: A jQuery12 plugin. I didn’t want to use a jQuery doesn’t mean you won’t either. Built on top of SHJS (See above). Boasts 39 unique color themes. Minified, the plugin is ~67kb and the css is about ~50kb. Precisely the reason, I wouldn’t want to use a jQuery plugin.
- sunlight: “Intelligent syntax highlighting”, so states the tag line. Haven’t tried it yet. On disk, the minified core is ~6kb. Core plus the languages is ~76kb, minified. Provides a way to extend it’s functionality.
Don’t want to use a client-side syntax highlighter?
Consider using an online tool that generates the CSS and HTML for you, on the spot. You can then, copy paste this over to the post/page you want to highlight your code in.
Here are two such online syntax highlighting tools.
tohtml.com: A simple, reliable HTML/CSS generator. Just copy paste the code over into the text area. Then select the type of language from a multi-select. Select the style you want, and hit the Highlight button. Instant HTML/CSS for your code. Copy paste it back to your HTML file and it’s done!