News for hackers. Stuff that matters.
Re:PrismJS by phoboslab on Tuesday July 31, 2012 @06:55AM (#4316585)
If you want an even smaller (sans jQuery) JS highlighter that doesn't fail on edge cases, check my jQueryJSH: http://www.phoboslab.org/files/jquery-jsh/

github: https://github.com/phoboslab/jQuery-JSH

Re:PrismJS by jacobr on Tuesday July 31, 2012 @07:50AM (#4316741)
1) How do I know it doesn't fail on the same edge cases Prism might fail on? I see no tests.

2) Do you really need jQuery there? You seem to be using it only for the html method, and including 93K extra JS instead of just using innerHTML seems a bit overkill.

Re:PrismJS by Xurinos on Tuesday July 31, 2012 @08:08AM (#4316794)
2) Do you really need jQuery there? You seem to be using it only for the html method, and including 93K extra JS instead of just using innerHTML seems a bit overkill.

It checks for the case that .innerHTML setting is not supported (I think that was for certain versions of IE) and switches to using appendChild(). I think that that small oversight is somewhat reasonable justification for using a wrapper that abstracts away the browser differences, although it can be argued that once someone understands the differences, they could just add the use cases to their code.

Re:PrismJS by saurik on Tuesday July 31, 2012 @10:12AM (#4317304)
I am somewhat confused why you would trust tests for edge cases sufficiently strongly so as to distrust an implementation without any; edge cases should be proved from first principals, as you can't possible test all of them.
Re:PrismJS by jarek-foksa on Tuesday July 31, 2012 @08:19AM (#4316824)
But smaller does not always mean better. Benchmarks have shown that parsers based exclusively on regular expressions can be even several times slower than parsers that use scanner/tokenizer.

The bigger regExps you write, the slower and more bug-prone your code will be.