• Resolved rickmaurinus

    (@rickmaurinus)


    Hi there,

    Appreciate any help I can get. I have used the SyntaxHighlighter happily for a while. Recently I moved my site from one server to another, and duplicated my website. All works well, also the plugin formatting at the front end.

    However, a side-effect of moving my server, is that something has changed when writing posts. In the screen where I write posts, I use the Syntax Highlighter block to paste my code. This used to work perfect. A character that would show directly underneath another, would also show this at the front end.

    However that stopped working. So:
    – The front end code now looks good for users
    – When I write the code in the post editor screen, it looks as if the characters do not align, even though in the front-end they do.

    My issue is purely in the code-editing screen. And this takes away a lot of my productivity. To check whether indentation is now okay, I need to ‘Preview’ the post and wait till WordPress shows the front-end. I really really really would like this to work again.

    Please see these screenshots
    Post editor: https://snipboard.io/KVCgqU.jpg
    Website front-end: https://snipboard.io/vHh7kW.jpg

    I’m using the theme: Generatepress version 3.1.0

    Everything worked before I copied my site to a new server, so I don’t see why this should have happened.

    I also tried disabling all other plugins, this didn’t help.

    Does anyone have suggestions on how to fix this?

    Rick

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Rick,

    > – The front end code now looks good for users
    > – When I write the code in the post editor screen, it looks as if the characters do not align, even though in the front-end they do.

    Could you answer a few questions, so we have a better idea of what might be going on?

    – When you moved servers and ‘duplicated’ your site, how did you perform the duplication (plugin, a tool on your host, etc?

    – Did you update anything after the move?

    – When you say the characters don’t align in the block (in the post edit screen), does that happen as you’re typing, after you save, or something else?

    – what version of SyntaxHighlighter are you using? (current is 3.6.1, released November 2021).

    – how are you aligning things? That is, are you hitting the space bar, or are you using the TAB key?

    – which editor (v2 or v3) do you have set in the SyntaxHighlighter->Settings?

    – were you using the SyntaxHighlighter block before you moved servers?

    All that said, I’m not able to duplicate this as you describe it – the strange thing is, I seem to have the reverse issue!

    For example, when using your code in the SyntaxHighter block, I can align it just fine as I’m typing (and it remains that way after a save):

    Edit Post BE Syntax Block My WordPress Site WordPress 2022 03 20 12 45 26

    But on the front end, using Generatepress 3.1.3, it does NOT align:

    FrontEndSHE

    (I’m singling out Generatepress, but it also happened with TwentyTwentyOne and TwentyTwelve, so I don’t think this is a theme issue.)

    This seems to be an issue with the Syntaxhighlighter BLOCK (vs SHE itself.)

    For example, here’s a plain Code block vs SHE block:

    BlocksMisAlign

    Because this is likely a bug, I’ve created an issue here:

    https://github.com/Automattic/syntaxhighlighter/issues/233

    which will be the best place to look for updates or add additional information.

    Thanks for bringing this to our attention!

    Cena

    Thread Starter rickmaurinus

    (@rickmaurinus)

    Hi Cena,

    Thanks for your swift response. Let me get back to you on the questions:

    – When you moved servers and ‘duplicated’ your site, how did you perform the duplication (plugin, a tool on your host, etc? I’m using Cloudways. They have a button that allows you to clone a server and move it to the next one. It didn’t involve anything from my side. AFAIK they duplicated everything exactly.

    – Did you update anything after the move?
    The issue appeared straight after duplication of the server. I tried launching an empty wordpress (https://rickmaurinus.com) and seeing if the issue appeared there too, on the same server. And also there the issue was present.

    So in essence things were identical at the change. I have later on updated some plugins to stay up to date, including SyntaxHighlighter Evolved.

    – When you say the characters don’t align in the block (in the post edit screen), does that happen as you’re typing, after you save, or something else? The misaligning happens straight away when I type code, and also remains after I save. The only part on my website where it works, is at the front-end that the readers see. By the way, I’m using the Syntaxhighlighter Block, and no shortcode.

    – what version of SyntaxHighlighter are you using? (current is 3.6.1, released November 2021). I’m currently using Version 3.6.1, but had an earlier version before.

    – how are you aligning things? That is, are you hitting the space bar, or are you using the TAB key? I am using the spacebar to align things. My feeling is that the plugin spaces based on the width of a character, instead of using a monospaced distance

    – which editor (v2 or v3) do you have set in the SyntaxHighlighter->Settings? I’m using Version 3.x

    – were you using the SyntaxHighlighter block before you moved servers?
    Yes, I have been using it for the last 1.5 years or so

    Thanks so much Cena, hope we can find a fix.

    Regards,
    Rick

    • This reply was modified 4 years, 2 months ago by rickmaurinus.

    Hi Rick,

    Thanks for the additional information! I don’t see anything there (except previously outdated SyntaxHighlighter, which you’ve already updated) which may have been an issue.

    The (new) strange thing is that I just tried testing this again, and now I can’t duplicate the problem at all.

    Here’s the SyntaxHighlight Code block, which was cut and pasted from the SHE code, then manually aligned via spacebar:

    Add New Post My WordPress Site WordPress 2022 03 24 09 26 47

    Saved, remains the same.

    Here it is looking good on the front-end too:

    Another alignment test My WordPress Site 2022 03 24 09 26 30

    This is a puzzle. I originally tested this on a different test site than the one above, so I went back there and tested again.

    This time, I also can’t duplicate on the backend:

    Edit Post Another SHE alignment test on WPJM My WordPress Site WordPress 2022 03 24 09 34 48

    but on the frontend, the top line is off:

    FEWPJMsyntax

    But now, AHA! After fiddling around with spaces in the block editor, and saving,my frontend is now messed up:

    Afteredit

    And no amount of editing on the post edit screen seems to fix it.

    So then I went back to the new site and tried to duplicate this there – I edited the existing block, and saved, and it appears correctly on frontend (ie, with the misaligned comment):

    NewSiteFE

    re-editing the post/block to re-align the comments results in the desired frontend appearance.

    So I’m not sure what’s going on here at all. Both sites have essentially the same plugins installed. I don’t have any caching plugins on either site. (I was starting to suspect caching.) My host does allow me to flush the object cache, so I tried that; no dice.

    I’ll post this in the issues thread in Github, and ping a developer to take a look

    Best,
    Cena

    Thread Starter rickmaurinus

    (@rickmaurinus)

    Hey there,

    Just curious about the follow up. I saw the bug report in github. How do these things usually get handled? Should I just wait till the bug is fixed at some point, or want me to check in and provide more input perhaps? Regards,

    Rick

    Plugin Support Alba

    (@ctdealba)

    Hi @rickmaurinus

    While we don’t have an estimated timeframe for when this may be fixed, we can certainly let you know once we have an update or feel free to check back with us in the future. If you would like to add more input, feel free to do so in the GitHub report.

    Best,
    Alba

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Block Code Formatting does not align’ is closed to new replies.