code-block-pro icon indicating copy to clipboard operation
code-block-pro copied to clipboard

How to avoid this white space problem using code block pro ?

Open rodrigomc2000 opened this issue 1 year ago • 5 comments

Hello everyone :)

My JSON example have a large link:

https://pps.whatsapp.net/v/t61.24694-24/323970788_1137981286878828_1882391295127733628_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdRIhDQmoDnnUAXJdVlRp9eCiVzLdQK5ogchK1GhiSLnAw&oe=6534E077&_nc_sid=000000&_nc_cat=101

And it's causing a horizontal scroll in front end:

hXXmpSyzX5

But in page builder show correct:

u6qeD2gWUm

How to fix this?

Thanks

rodrigomc2000 avatar Nov 08 '23 21:11 rodrigomc2000

It's designed to scroll like that intentionally. I'm going to look into adding it as an option but its a bit complicated to get it working with all the other features (like line highlighting, for example)

If you wants to share a link to your site I can look at it. You can also try css like this:

div[class*='code-block-pro']:not(.x) pre {
    padding-right: 12px !important;
}
div[class*='code-block-pro']:not(.x) pre code {
    white-space: normal !important;
}

KevinBatdorf avatar Nov 08 '23 22:11 KevinBatdorf

Hey Kevin thanks for reply!

I tried this custom css ! it works but remove all tab indent of the code.

rodrigomc2000 avatar Nov 08 '23 22:11 rodrigomc2000

In place of "white-space: normal" go here and try out the other options to find the best one. Maybe pre-wrap?

https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

You have some text there that's not simple to break so it might not work.

KevinBatdorf avatar Nov 08 '23 23:11 KevinBatdorf

Just wanted to confirm that white-space: pre-wrap is what works best.

bugnumber9 avatar Jan 03 '24 14:01 bugnumber9

What ever the default I have there is what works best. If you to customize it though then you can try one of the other options.

KevinBatdorf avatar Jan 03 '24 14:01 KevinBatdorf