Search code examples
javascriptsyntax-highlightingbrowserifybrowserify-shim

Code highlighting js that would work with Browserify?


I am looking for a code highlighter that would support main coding languages (sass/scss also) and would work nicely with Browserify.

At the moment I was using prismjs, it works just nice (as highlighter), but I cannot seem to make it work with Browserify. Recently, I started using Browserify (which is awesome) and works fine with all scripts and modules, except highlighter (which I need).

Is there a good code highlighter that works fluently with Browserify without major hacking? :)

Thanks in advance.


Solution

  • Prismjs works now seamlessly with browserify.

    const Prism = require('prismjs');
    Prism.highlightAll();
    

    This would basically do the same as using the script tag version.