Rising scroll threshold in code blocks (or complete unfolding)

When you insert a Markdown code block (```) into your message, it receives automatic vertical scrollbar if its content is long enough. But I don’t mind having long listings in messages and want to display code inline until it reaches, say, 200 lines long. Is there a way to control this threshold?

Alternatively, if no such threshold can be set, is it possible to completely unroll the listing regardless its length? I tried setting display: table to code tag, it worked, but block width got shrink to content width too. So I tried setting width: 100%, but that resulted in having horizontal scrollbar emerged. I’m not that skilled in CSS, could anybody please help me?

You want to adjust and/or remove the max-height attribute of pre code

So in your Admin > Customize > CSS/HTML > CSS area, put

pre code {
  max-height: 800px;
}

You can change 800px to any number really, it simply implies when the code block reaches that amount of space, start showing the scrollbar.

5 Likes

Thanks! That works like a charm and is exactly that I wanted.

Or - scattershot, but working so far:

pre code {max-height:none;}
pre      {max-height:none;}

My outer pre has a max height of 2000px, so needed adjusting also.