Script of the Day: Prism

A JavaScript library for syntax highlighting source code

Embedding source code on a Web page might seem easy to do, but the final result will disappoint most editors or designers. To help improve source code readability, visibility and general styles, famous developer Lea Verou has developed the Prism library.

Coded in vanilla JavaScript, Prism is framework agnostic, meaning it will function with or without any JavaScript library loaded on the page.

Prism works by taking over HTML code blocks, adding features inspired by desktop IDEs and colorizing the outputted code to help readers decipher embedded code much easier and faster.

By default, the library can differentiate between HTML, CSS, JavaScript and Java syntax, but thanks to its included plugin architecture, new programming languages can be added with ease, along with new features and quirks.

The Prism source code can be forked from GitHub.

Download Prism from our Scripts section here.

Hot right now  ·  Latest news