On Feb 27, 3:44 pm, Logan Capaldo <logancapa... / gmail.com> wrote:
> Does it have to be JS? You gonna do client side lexing of ruby in JS? (I
> guess it has to be, else you wouldn't have asked.)
>
> * forges on anyway *
>
> Sure you can't usehttp://coderay.rubychan.de/instead?

I could, for sure. That trades bytes over the wire for user's cpu
time. Sometimes I just really like having code syntax highlighted by
the page, particularly when it's a tiny snippet as part of a larger
page, and not an entire source file.

I hacked the second library I found to do what I want. Although I'm
annoyed with its speed, it's working reasonably OK for now. It looks
like I was wrong, that is has some form of 'real' lexing applied via a
very incomplete idea about Ruby syntax. If no one has a premade JS
library for this, and if it bothers me enough, I'll spend some time
understanding its scoping and lexing rules and see if it can make the
jump from string mode back into code mode. My quick hackery to add
some features makes it look possible.