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();
}
}

2 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.

CodeCoaster said...

Hi Barry,
I dont know your EMail address and this seems to be the only way to contact you. I have been assigned to write chunk 55. As you have already written a great introduction to it, would be ok with you, if I used your intro for the chunk? Of course you would get full credit for your work and we would share authorship of Chunk 55.
Please reply to codecoaster at googlemail.