Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Code tags vs Readmore

by chacham (Prior)
on May 23, 2014 at 11:20 UTC ( #1087193=monkdiscuss: print w/replies, xml ) Need Help??

There are a couple things i wonder about, from time to time, about the code tag. One, the width makes a lot of code wrap when on my screen there is no need. Two, code can get longer and i wish it were a readmore tag instead.

The code tag seems to wrap at 70 characters, is that to support terminals? Perhaps that could be an option, so those with wider screens have the option of seeing it unwrapped.

The readmore tag is intended to keep a post from being too long. Yet, though a code tag pretties it up, it does not shorten it. Leaving it long certainly allows for quicker reading on the page, though it hinders getting to the start of the next post.

Just some thoughts.

Replies are listed 'Best First'.
Re: Code tags vs Readmore
by parv (Priest) on May 23, 2014 at 11:46 UTC

    Feel free to adjust for yourself ...

    p.code , pre.code { overflow: auto; max-height: 55ex; max-width: 101ex; }

    ... to put too long, too wide of a code in a scrollable widget.

    My personal setup is in perlmonks-dark.css.

      Nice! It makes it nice and tidy without hiding the code at all. That's be an interesting option, "Show Readmore as Scrollable Box".

      I tried the full script. It is more readable, but too dark and large for me. Well, too large in that it takes up so much space. If i decide to tweak settings at some point, i think your script would be an excellent starting point. Thank you for the script, and for showing the relevant part on its own.

      Sheesh! I wonder how many times i skimmed over that. It just didn't click until this example and you pointed it out.

      Anyway, put it in, now to test it out. Thanx!

        There are multiple ways to adjust the CSS. I use the Dark theme as a base and my own on-site CSS regarding code is here.:

        .codeblock { max-height: 37em; max-width: 72em; overflow: auto; margin +-bottom: 10px; border: 1px dotted white; border-left: none; padding: +15px; } pre { max-height: 42em; max-width: 75em; overflow: auto; padding: 5px +; }

      Would you explain where to use that?

        display settings again! :)

        -> On site CSS markup

        Cheers Rolf

        ( addicted to the Perl Programming Language)

Re: Code tags vs Readmore
by LanX (Bishop) on May 23, 2014 at 12:41 UTC


      I thought i remembered all the settings from when i tweaked them the first time. Silly me, Code Wrapping Off, Code Wrap Length, and Show download link on code N lines long or more, are all there with other options.

Re: Code tags vs Readmore
by MidLifeXis (Monsignor) on May 23, 2014 at 12:37 UTC

    You can use both of them in tandem:



      But, what if i want to show the first few lines of code and then readmore? I wish everybody would do that to remove a lot of the clutter.

        Do the scrolling css deal, limit the height :)
Re: Code tags vs Readmore
by Anonymous Monk on May 23, 2014 at 11:27 UTC

      If it's there, i don't see it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://1087193]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-03-18 04:33 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (228 votes). Check out past polls.