Syntax colored code

Saturday 12 June 2004

In Fredrik Lundh’s breezy list of happenings at EuroPython I saw a reference to SilverCity. It’s a Python module for lexing source code, making use of Scintilla. This is an odd inversion: I would have expected a syntax-coloring editor to make use of a lexer module, not the other way around, but so be it.

I hooked up SilverCity into my blog system, tagged my samples by language, and it works great. Now my code samples are all syntax colored automatically. And with the samples tagged, I can also compile a useless census of code samples by language:

Python17C++14
HTML9PostScript5
XSLT4CSS3
JavaScript3

with one each for ActionScript, DOS batch file, M3U, Perl, .htaccess, PHP, and XML.

Aside from all the code samples that were really just text files or console displays, the trickiest entry was the polyglot C and PostScript code, where syntax coloring for a single language would ruin the fun.

» 1 reaction

Comments

[gravatar]
Micah Goulart 10:32 AM on 14 Jun 2004

Do you know of any JavaScript program that color-codes HTML inside Textareas?

I was thinking of making one, but thought I'd look first.

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.