I'm looking for a JS library that will find <code class="ruby"> (or
otherwise-specified) elements on an HTML page and wrap bits in <span
class="keyword">...</span> type elements for CSS syntax coloring of
the original source.

I've found two JS-based syntax highlighters ([1] and [2]), but both
fail on Ruby code like:
foo = "Hello #{ "World" }"

They're both regexp-based, which is the problem. I'm happy to use them
for quick-n-dirty highlighting, but I'm hoping that someone has
written a lexer/parser that handles more complex situations like this
(even if it doesn't cover every single edge case).