Highlighting Code in HTML
Ever wonder how people do things but you feel too silly to ask? I do sometimes. Take code highlighting on the web for example. I see people posting fully highlighted code snippets in their blogs and I have no idea how they managed it. Surely they weren't doing it all manually.
I still don't know how most people do it but I have found one way to do it. After what seems like an age, my favourite text editor, TextPad, has had an upgrade. One of the new features is the ability to:
Publish your code on the web, with full syntax highlighting, using the new "Copy as a HTML page" command.
Here's an example (and a piece of code worth keeping hold of):
//Remove leading and trailing spaces from a string //Originally written by Jim Fricker function trim(aStr) { return aStr.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") }
Nice. You can even create your own highlighting definitions. Thanks to Page Nix there's already one for LotusScript and @Formulas that we can download from the site along with many others. Not sure how useful it is to be able to have coloured HTML of your Notes function but it appeals to me as the owner of a code store ;o)
REM "Function to create a calendar of a month's blogs"; tmp := @DbLookup(""; ""; "calendar"; ShowBlogsFor; 2); blogs:=@If(@IsError(tmp); ""; tmp); startDate:=@Date( @TextToNumber(@Left(ShowBlogsFor;"-")); @TextToNumber(@Right(ShowBlogsFor; "-")); 1); startDay := @Weekday( startDate );
Another nice new feature is the ability to paste text you've copied from IE or Mozilla in to an open .html document with all the markup intact. A bit like Domino Designer does with Pages but not as annoying ;o)
Textpad is quite cool doing that, but even more cool is Julian's ls2html {Link} script that does the same thing but in LotusScript!
Speaking of Julian's ls2html routine, Joe Litton posted a cool LS example (Win API to mimic keystrokes) and rendered the LS using ls2html.
URL: {Link}
Nice work. Joe Litton's blog looks good. Is it me is there a new Domino blog out every day. Finding it hard to keep up with it all at the moment ;o)
Jake, it's not just you. There *IS* a new Domino blog just about every day. I was pretty late getting into this (been programming for 17 years and doing Notes for 7) -- only started looking at blogging a couple of months ago. MAN! there's some great stuff out there. Including tips for Domino hosting -- I read about Prominic on Codestore and that's where my site's hosted now.
I've been with Prominic for about 18 months I believe, ever since Jake recommended them. I have to say I've yet to think of a negative comment.
It's just a pitty I can't find a similar service for Coldfusion MX - the next thing I want to play with.
They may have Coldfusion MX hosting here...
{Link}
...but I'm not sure. The content and links didn't make sense to me.