5

I'm looking for a good all rounded syntax highlighter written in JavaScript that will auto detect the language used and apply proper syntax highlighting.

I've found a myriad of them from a simple Google search but they all have to have some sort of formatted class on the <pre> element like <pre class="highlight-php">.

I noticed StackOverflow's syntax highlighting manages to do it automatically from within pre blocks, anyone know what library they're using?

Thanks!

1 Answer 1

7

They are using google prettify. There are other options, such as highlight.js

1
  • highlight.js seems by far the best solution.
    – Lea Hayes
    Mar 8, 2014 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.