Tuesday, 28 October 2008

Formatting of code fragments on blogs

I have just left a comment on Darrel's blog regarding formating of code fragments within a blog. Unfortuantly, the blog commenting facility doesn't allow use of the HTML pre tag, and hence the point I was trying to make was somewhat lost! For clarity, I repeat it here.

Use of the HTML pre tag leaves white space intact, allows direct use of > and <, and uses a courier font. E.g.:
setup(){
int x = 0;
if (x > 0){
doSomething();
}
}

1 comments:

CodeCoaster said...

Hi Barry,
I also thought the pre tag was an answer to Darrels comments but in practice ot didnt work for the blogger application. Most of the text was ok in the pre tag but I had to replace a &gt symbol and line up the text after it.
I dont know why this happened as there were other comparotors that displayed properly in the pre tag before this one.