Forums Register Login

Indenting code in posted text

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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).]
+Pie Number of slices to send: Send
"Ahh... I see," said the blind man!

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?
+Pie Number of slices to send: Send
Where is the text entry page you are thinking of?
(I fixed the tags in that message above - I should double check these things more often!)
+Pie Number of slices to send: Send
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:
+Pie Number of slices to send: Send
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."
+Pie Number of slices to send: Send
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"?
+Pie Number of slices to send: Send
Even better, 'cause it's closer to where you type.
Friends help you move. Good friends help you move bodies. This tiny ad will help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1042 times.
Similar Threads
OutOfMemory error
Missing IN or OUT parameter at index:: 1
copying a file
Need help with structure...
Paging -- Has anyone done it via Spring Framework?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 02:08:44.