Tuesday, May 16, 2006

The first step - colored code samples

Not only formatted (whew, with the genuine "pre" html tool), but colored.

Let's try it.
int main()
{
printf("hello world\n");
return 0;
}
All right, this is nice, at least for me now.
It has some drawbacks, along with how this blogger works (inserting 'br's instead of leave 'pre's untouched, and inserting some more linebreaks after my 'pre' and 'div' tags).
But all I typed copied is clean text included in html 'pre' tags (preformatted):
int main()
{
printf("hello world\n");
return 0;
}
I've just wrote some javascript to format code blocks, after the page is loaded, on the client. In my next post I will show how I did it, altough you can just simply see it in the page code.

It's a quick and dirty hack, but will do it for now.

0 Comments:

Post a Comment

<< Home