Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Highlight.js Highlights Syntax for 51 Languages with 20 Style Themes

DZone's Guide to

Highlight.js Highlights Syntax for 51 Languages with 20 Style Themes

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

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 51 languages and is bundled with 20 style themes.  The library now works not only in a browser but also with node.js. It is installable with npm install highlight.js.

It also a new unique feature (apparently) among syntax highlighters which 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.

You might also be interested in Rainbow - A Code Syntax Highlighting Library Written In JavaScript.



Requirements: None
Demohttp:/ / softwaremaniacs. org/ media/ soft/ highlight/ test. html
License: BSD License

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Published at DZone with permission of Hirvesh Munogee, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}