Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Code tags vs Readmore

by chacham (Priest)
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.

Comment on Code tags vs Readmore
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.

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.

      Would you explain where to use that?

        display settings again! :)

        -> On site CSS markup

        Cheers Rolf

        ( addicted to the Perl Programming Language)

      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 +; }

      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.

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

    You can use both of them in tandem:

    --MidLifeXis

      Duh!

      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 LanX (Canon) on May 23, 2014 at 12:41 UTC

      Thanx!

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://1087193]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2014-12-28 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls