Friday 10 October 2008

Blog syntax highlighting: SyntaxHighlighter

I've been wanting a Javascript based purely client-side syntax highlighting solution for a while. In the past, I've used Python to HTML scripts and other similar things.

SyntaxHighlighter looks pretty good.


import stackless
import traceback

def f():
while 1:
pass

stackless.tasklet(f)()

while stackless.runcount > 1:
# If any tasklet runs for too long, kill it.
t = stackless.run(100000)
if t is not None:
traceback.print_stack(t.frame)
t.kill()

3 comments:

  1. I tried this on an unpublished project and ended up going for the server-side alternative because it barfed on large source texts.

    ReplyDelete
  2. That is mentioned as one of its limitations, that it uses regular expressions and with larger amounts of source code the javascript will timeout. I'm fine with that.

    ReplyDelete
  3. i like SyntaxHighlighter and i've also found another solution using the dojo toolkit - neonstalwart: alternative syntax highlightingl

    ReplyDelete