Ok, so is 24 the authoritative number? If so, the part of the footnote 1 on Perl Monks Approved HTML tags which says

"... and please use <code> instead of <pre> unless the enclosed lines are pretty short."

could be modified to read something like

"... and please use <code> instead of <pre> unless the enclosed lines are less than 24 characters wide (as they typically won't be wrapped by browsers). Don't use <pre> at all if the reply level of the node in question is deeper than 4."

That would be a pretty minor change, and hopefully, clearly telling people what the rules are will avoid having to "beat" them to it (though admittedly, that might work only with the more civilised ones).   In case 24 isn't ok either, we should probably do away with <pre> altogether...

It wouldn't be particularly hard to parse <pre> blocks and re-render them as things that use fixed-width fonts and preserve whitespace but also are willing to wrap.

Until that is done, would it be ok if I enclose such sections in <p><tt>...</tt></p>, adding <br /> at the end of every line, and replacing every other space with &nbsp; in stretches of consecutive spaces? (<tt> doesn't preserve whitespace)  At least in Firefox that seems to render as intended. Any better suggestions how to highlight stuff in preformatted sections?

(BTW, it will always be a mystery to me why browsers on small-screen devices don't allow you to configure something like "forced wrap" for preformatted sections...  But that's another issue.)


In reply to Re^4: <pre> vs. <code> tags ("wide") by almut
in thread <pre> vs. <code> tags by almut

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.