While you can expect codeblocks to preserve the formatting of your code (unless you have codewrapping enabled, but additional line breaks are made explicit by adding a red '+' and not incrementing the line number), I just discovered that this is not the case with inlinecode. The browser can insert a line break wherever a space is present if the line is too long. Most of the time this is not a big issue since there's no difference between a space and a line break outside of string constructs, but I'd still like pieces of code that were meant to be a single line to be displayed on a single line (as a matter of fact, I discovered this on a regex with the /x modifier, so one of the cases where whitespace doesn't matter).

I added this line .inlinecode { white-space:nowrap; } in my CSS, so I don't have the problem anymore. But there might be other monks around who would like the oneliners to always be displayed on one line, and I think this change would make sense as default behaviour.

NB: if you want to try for yourself, here is a one liner that you can break into two lines by resizing your browser's window: perl -lne '(1x$_) !~ /^1?$|^(11+?)\1+$/ && print "$_ is prime"'


In reply to No line breaks in inline code by Eily

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.