Javascript only solution to syntax highlighting


Syntax highlighting is one of the first problems developers and technical writers will encounter once they start publishing content with code snippets or extracts on the web. While this is not a crisis by any means, having your code excerpts highlighted does make them standout and is more aesthetically pleasing.

Here I present a quick and simple solution powered by javascript to solve this problem. It is lightweight and can be embedded in the frontend of whichever content management platform you chose to utilize be it Wordpress, Drupal, Ghost, etc.


highlightjs is the library that will be featured in this article. Known for the accuracy of its parser and the bredth of languages supported it is our chosen solution to power our code colouring in this example.


Read full piece at