• Resolved bryanhiggs

    (@bryanhiggs)


    I’m using the Blocksy theme in my WordPress website, and using Code Block Pro to provide C++ syntax highlighting. I suddenly noticed that all my != are being converted to ≠ , which is not valid for C++.

    Is the plugin misbehaving, or could the theme or WordPress be the culprit?

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter bryanhiggs

    (@bryanhiggs)

    Note that there are WordPress Block Editor <code> blocks elsewhere on that website that contain != without this kind of conversion.

    Plugin Author Kevin Batdorf

    (@kbat82)

    Hey Bryan, if you go to the settings area and look for fonts, you can change the font to a non-ligature style font.
    I believe if you copy paste the code even with ligatures enabled it’s still valid c++ though as you’re not getting the single character. It’s purely for style. But you can choose from multiple front styles there.
    Let me know if that doesn’t work.

    Thread Starter bryanhiggs

    (@bryanhiggs)

    Thanks, Kevin.

    I went into the Fonts section. I found it was set to JetBrains Mono. I changed it to JetBrains Mono (no ligatures), and that fixed it. Simple when you know where to look (I didn’t!).

    Is there any case where you display code using this plugin where ligatures are acceptable/useful? Especially, shouldn’t the default font be a non-ligature font?

    Plugin Author Kevin Batdorf

    (@kbat82)

    its really just a stylistic choice, I guess. I personally like ligatures so I made that the default. I understand not everyone does though. What can I really do besides flip a coin and choose a setting, right? I went with my own preference (love it or hate it).

    But I think regardless it would copy/paste the normal characters either way.

    Thread Starter bryanhiggs

    (@bryanhiggs)

    Well, I guess it depends on what you’re trying to format. Languages like C, C++, Java, etc. should not, IMHO be subject to ligature changes. The code should look exactly the same as the original.

    But I went in and looked at what other languages/things you can format (the choice in the settings), and realized that I didn’t know what a lot of them are, so couldn’t tell whether they should be subject to ligatures or not. You are much the better judge of that.

    Choose a suitable non-ligature font when a language like C, C++, Java is chosen, so sensible things happen in those language cases?

    Plugin Author Kevin Batdorf

    (@kbat82)

    its just a cosmetic/presentation decision though. If someone copies your code either with the copy button or by manually selecting the text and copying it, they will get the literal characters you typed in, not anything different.

    I’m not disagreeing with you in principle though.

    I’m happy to consider to feedback, of course, and adapt the plugin over time. I know what I prefer personally might not be the best choice “ethically” as a default (most people use the default settings so I have a responsibility to make those settings the best for the community as a whole).

    I’ll ask around and get some more opinions on it too.

    Thread Starter bryanhiggs

    (@bryanhiggs)

    Thanks for considering my input.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.