Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

While working on something else, I realized that I could make <code> tags automatically wrap code to (roughly) fit your window. So you can now go to user settings and check the "Auto Code Wrap" option and any stuff inside of <code> tags will be rendered such that your browser will wrap it to fit. So if the code is hard to read because it is wrapped too much, just widen your browser window.

If someone puts a really long string without spaces inside of <code> tags, then your browser won't wrap in the middle of this really long string. This is a pain, so if you have "Auto Code Wrap" checked and you also enter a number (say "20") in "Code Wrap Length" (leaving it blank doesn't default to "70" in this case), then we'll insert a red soft hyphen after each run of 20 non-space characters. These will be invisible (on a conforming browser) unless your browser decides to wrap the code at that point.

You can also now enter a "Code Prefix" which will be prepended to each line of code displayed. If you include a run of digits something matching /&\d+;/ in this prefix, then those digits will be incremented for each line of code. So you can use a prefix of, for example, "&001;:&nbsp;" to have all lines of code numbered. Note that &#8226; includes a bullet while &8226; would start numbering lines at 8226.

Note that "Code Wrapping Off" overrides all of these settings.

Also, if you have "Auto Code Wrap" checked (and no Code Prefix defined), you might be tempted to skip the "d/l code" link and just cut'n'paste the code directly. However, if you've entered a number for Code Wrap Length and that code has any strings of non-space characters that long or longer, then you'll get some soft hyphens included (even though they might be invisible) which will break the code.

I've tested things quite a bit but there were a lot of changes involved and some browsers may not like the red soft hyphens (if so, then either don't check Auto Code Wrap or set Code Wrap Length to be empty)...

If you'd like to test your new settings, try Re: Space or Soft Hyphens (see code wrap).

        - tye (but my friends call me "Tye")

In reply to New code wrap options by tye

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2022-01-29 07:57 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (74 votes). Check out past polls.