Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

RE: Automatic CODE tags

by Anonymous Monk
on Jun 21, 2000 at 12:05 UTC ( #19179=note: print w/replies, xml ) Need Help??

in reply to Automatic CODE tags

I haven't been clear on the right use of monospacing tags here, either--
for instance, why <CODE> is preferred to <PRE>.

Tags like <KBD> and <CODE> are normally used for monospacing
in-line. If you wrap a multi-line block of text in <CODE> tags, you expect
the line breaks to disappear when the HTML file is displayed
in the browser unless you also add <BR> tags at the end of each line.

But wrap that same text in <PRE></PRE>, and the line breaks are
handled fine without need for <BR> tags.

I recall hearing a while ago here that the site turns <CODE> into <PRE>--
but then wouldn't that be the wrong thing to do when the intent was
to add monospaced text in-line?

Replies are listed 'Best First'.
RE: RE: Automatic CODE tags (kudra: how/why CODE > PRE)
by kudra (Vicar) on Jun 21, 2000 at 12:56 UTC
    This by no means represents the official reason, it's simply my own thoughts on the reason behind the <code> tag.

    It looks as if the tag is handled in a special way (just as the square bracket links are). The fact that you can select how code is displayed in user settings seems to indicate this. Currently it looks as if the <code> tag is treated as a <pre> tag.

    One advantage of having the tag interpreted is that it's easy to change what it does either globally or by user. I imagine the term 'code' was chosen because the content is, in fact, code, so it ought to be easy to remember. Unfortunately it appears to be confusing as well. Using <pre> would also be confusing, because there's no guarantee <code> always is or will be directly converted to <pre> (<code> seems to be replaced with <pre><it> for me; if I turn off 'large code font' in my user settings, it replaces it with <pre><it><font size=-1>).

      <Code> also HTML-ize's any special characters (ampersands, angle-brackets, etc)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://19179]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2017-08-21 05:51 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (317 votes). Check out past polls.