shortcode - Wordpress 5.1 and Syntax highlighter, problem with HTML encoded special characters

admin2025-06-02  0

I'm using Wordpress 5.1 and Gutenberg block editor. I'm trying to show some Java code with the plugin SyntaxHighlighter Evolved. When editing a post I use the block 'Custom HTML' then add the code

[code language="java"]
List<Integer> myList = new ArrayList<>();
[/code]

Then I save the post and the Java code will appear correctly with syntax highlighting applied to it. It will look like this

This is the result that I wanted. But a problem happens when I edit the post again, in the Wordpress editing the Custom HTML block changes to the following

[code language="java"]
List&lt;Integer&gt; myList = new ArrayList&lt;&gt;();
[/code]

The < and > signs have been replaced by &lt; and &gt; and the code on the website becomes

Does anyone know how to fix this? thanks

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748844508a314196.html

最新回复(0)