• The Gutenberg editor has a problem with the “&” character which it converts into “amp;” Is there any workaround with your plugin? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jan-Philip Gehrcke

    (@jgehrcke)

    Hey @tathros!

    Thanks for using the plugin and thanks for the question. I have not officially tested and qualified the plugin to work with Gutenberg yet. However, please try the following:

    Have a look at https://gehrcke.de/wp-geshi-highlight-demo/ and specifically at these two examples called:

    – “HTML, without decoding HTML entities”
    – “HTML, like above, but with decoding HTML entities”

    These two examples illustrate a technique based on the escaped=”true” option. That option allows you to have HTML entities such as > in your pre block content which after all displays correctly to your users. Example:

    
    <pre lang="xxx" escaped="true">
    < >
    </pre> 
    

    This will correctly display the < and the > characters. If you write “&” (which is the HTML entity for “ampersand”) it will decode to &.

    That is, I think if you just leave the “&” as-is, and add the escaped=true option to your pre block then the content will display correctly.

    Let me know how it goes.

    Jan-Philip

    Thread Starter tathros

    (@tathros)

    The escaped=”true” option works great indeed. Thanks!

    Plugin Author Jan-Philip Gehrcke

    (@jgehrcke)

    Thanks for the quick reply and I am glad that things worked already.

    I am still trying to edit my comment above to show the right thing (the WordPress forum messes with the code content in a not really predictable way, and I couldn’t find documentation… simple Markdown would be so much better).

    Plugin Author Jan-Philip Gehrcke

    (@jgehrcke)

    I am not allowed to edit my comment above anymore, but the code block still does not show the correct code (it shows the _decoded_ HTML entities, whereas it’s supposed to show them encoded).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘“&” character is converted in Gutenberg’ is closed to new replies.