Archived topic
Preformatted block not keeping the formatting on mobile
12 replies · Started by Jagmeet on February 16, 2022
Hi,
I have a preformatted block on a page (above the ToC), that keeps the spaces between lines on desktop, but when I view it on mobile, the line spaces are not there. The block does not preserve the formatting on the mobile devices.
The link is shared in the below.
What can I do to fix this?
Thanks!
Hi there,
Not sure if I'm seeing the issue.
This is what I see on the desktop view:
https://www.screencast.com/t/uqNAXK8e
And this is the mobile view:
https://www.screencast.com/t/MgMzUvbMBN
The space seems the same to me.
Can you elaborate?
That's not what I'm seeing.
Can you disable any caching plugin or SG optimizer first?
Done. I have purged the cache and disabled it.
I still see the line spaces on desktop site, but not on the mobile.
I still don't see any line spaces on the desktop and am also seeing SG optimizer still activated:
https://www.screencast.com/t/TPZhoc7G6q
I've hard cleared my browser cache and tried incognito mode.
Can you try again now? I have deactivated and deleted the plugin from my site.
Hi Jagmeet,
It seems working fine on both desktop and mobile now:
https://www.screencast.com/t/odcXM8hg
Yea, it is working fine now.
Seems like the caching plugin is minifying or something else to the preformatted block. Maybe if I exclude the preformatted HTML from minifying that would help. How to I find the preformatted HTML block code?
Thanks!
When I try to add <br> or <p> to preserver the formatting in the preformatted block, these tags get removed and everything gets squished together.
As Preformatted block is a WP core block, GP doesn't have control over it.
Here's its documentation:
https://wordpress.org/support/article/preformatted-block/
And if you are having trouble with it, reach out to WP:
https://wordpress.com/support/wordpress-editor/blocks/preformatted-block/
Thanks!
Thanks for the pointer.
No problem :)