As I begin to read many threads here, it occurs to me that many of them include code snippets that would be easier to read if the indentation were preserved. I'm sure the style-conscious Sheriff Wheaton would agree. Is there a straightforward way to do this?
Oh yes! I usually use the HTML <PRE> and </PRE> tags around my code fragment to do this, although there are UBB CODE tags that can do this too (click on the "UBB Code is ON" link when you are writing a message for more info). Some forums have HTML turned off, so you would need to use the UBB tags.
[This message has been edited by Paul Wheaton (edited August 27, 2000).]
Nice. However, I did a brief survey of Ranch postings that include code that needs indentation and found that there are about 5 times as many such postings that don't use this than those that do (10:2). I wonder if a note on the text entry page to encourage this feature's use would help?
Also bear in mind that CODE and PRE are not quite as smart as most people would like. They both "eat" empty lines, so if you want blank lines to appear in your code examples, you need to put a space or two at the start of the empty lines:
Sheriff: The "text entry page" I reffered to is the one I'm typing on right now to post this reply -- the one where UBB accepts a new topic or reply. What I was thinking of was maybe a note somewhere near this big key-in field (maybe just below the moose head?) sayin' somethin' like "If yer gonna put indented code in yer post, wrap it up with CODE tags like granny in her quilt."
That sounds like a good idea. The only downside is rooting through the source code to find where that particular page is created and stuff in a bit of html. How about to the left where it says "Smilies Legend"?