• Resolved pavcreations

    (@pavcreations)


    Hello,

    I recently noticed that some of my code excerpts in articles contain some weird tags and fragments. For instance, in section Input Handler class in the following article at https://pavcreations.com/command-design-pattern-for-flexible-controls-schemes/ you can see tags at the end in one of the code listings that shouldn’t be there:

    </basecommand,></basecommand,></inputaction,></inputaction,></actioncommandpair></actioncommandpair>

    or the code is transformed to completely something else such as:

    public Dictionary<inputaction, basecommand=""> bindActions = new Dictionary<inputaction, basecommand="">();

    whereas it should be:

    public Dictionary<InputAction, BaseCommand> bindActions = new Dictionary<InputAction, BaseCommand>();

    I noticed it occurs mostly in C# listing but sometimes in other syntaxes as well. I’m on WordPress 6.2 and realise that the plugin has not been tested with this version yet. However, I would like to keep it because it really suits my requirements. Can you please let me know what can be done to fix this? Do you plan to release an update?

    Thank you so much in advance. Kind Regards.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @pavcreations ,

    Interesting! I grabbed some of your code samples from your site (leaving off the ‘weird tags’), and I can’t duplicate this:

    Screenshot Link: https://cloudup.com/cv8H_q9LeXO

    The first two boxes are using the Syntax Highlighter block, the third the plain old ‘Code’ block.

    How are you embedding the code?

    What code editor are you using?

    I vaguely wonder if your editor isn’t including some sort of ‘invisible code’ when you cut and paste into WordPress; for example, I can see what looks like a similar ‘weird tag’ in a post from 2020:

    https://pavcreations.com/parallax-scrolling-in-pixel-perfect-2d-unity-games/

    Best,

    Cena

    Thread Starter pavcreations

    (@pavcreations)

    Hi Cena,

    Thank you for prompt reply.

    Usually I first copy-paste my code into text editor and turn it to plain text so that no special hidden extra characters are pasted over. The editors I’m using are Visual Studio, CLion and PHPStorm (sometimes PyCharm) but again, I always turn my code into plain text first to eliminate the risk of transferring any weird “hidden” characters. I noticed it started happening after I upgraded to WP 6.2.

    One pattern I found here is that it happens whenever there are <> tags inside the code. For instance

    Dictionary<InputAction, BaseCommand>

    turns into

    Dictionary<inputaction, basecommand="">

    and after that it’s as if SyntaxHighlighter tried to close these tags at the end – and thus the weird

    </basecommand,></basecommand,></inputaction,></inputaction,></actioncommandpair></actioncommandpair>

    tags that appear at the bottom. My hypothesis is that the plugin somehow treats these as standard html / xml tags? If possible please try to paste this line on your side

    Dictionary<InputAction, BaseCommand>

    , select C# as the syntax and see if it’s going to appear on the front page of a blog.

    Kind Regards

    Plugin Support Jay

    (@bluejay77)

    Hi @pavcreations,

    Thank you for sharing examples here. Unfortunately, we still could not reproduce the issue on our end. Here is how it looks:

    Screen Shot

    The above test was done on a clean WordPress install without any other plugins–only the Syntax Highligther plugin was installed and activated.

    Would you try doing a test on a clean WordPress environment to rule out any plugin/theme conflicts? Health Check is a tool that can be useful for debugging, though it requires an official default theme like Twenty Seventeen. On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you while you’re logged in to that session without affecting normal visitors to your site.

    If you’re still seeing the issue even with all other plugins disabled, would you share a more detailed step-by-step instructions, so we can reproduce it on our end? A screenshot of your editor view would be very helpful. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Weird tags in code?’ is closed to new replies.