https://prismjs.com
Prism
Prism Dead simple Include prism.css and prism.js, use proper HTML5 code tags (code.language-xxxx), done! Intuitive Language classes are inherited so you can only define the language once for multiple code snippets. Light as a feather The core is 2KB minified & gzipped. Languages add 0.3-0.5KB each, themes are around 1KB. Blazing fast Supports parallelism with Web Workers, if available. Extensible Define new languages or extend existing ones. Add new features thanks to Prism’s plugin architecture. Easy styling All styling is done through CSS, with sensible class names like .comment, .string, .property etc Used By Prism is used on several websites, small and large. Some of them are: Examples The Prism source, highlighted with Prism (don’t you just love how meta this is?): This page’s CSS code, highlighted with Prism: This page’s HTML, highlighted with Prism: This page’s logo (SVG), highlighted with Prism: If you’re still not sold, you can view more examples or try it out for yourself. Full list of features Only 2KB minified & gzipped (core). Each language definition adds roughly 300-500 bytes. Encourages good author practices. Other highlighters encourage or even force you to use elements that are semantically wrong, like
(on its own) or