Using Prism for Syntax Highlighting
Up until today, Neuron used Pandoc’s skylighting to do syntax highlighting statically. However, skylighting supports a very limited number of languages.
To solve that, Neuron now uses Prism.js to let the client-side do all syntax highlighting.
Incidentally, this change allows users to swap out their syntax highlighting library by adding it to their head.html.
Documentation: https://neuron.zettel.page/syntax-highlighting
Breaking change?
If you use head.html, yes — you must add Prism JS and CSS manually, as Neuron only adds CSS classes to code blocks.
Footnotes
- Prism’s language support is actively growing, such as getting Idris support recently.
Example Code
function hello() {
console.log("Prism is working!");
}
hello();