Help with block element and escaped code
-
I develop a plugin that enables users to add code snippets and apply syntax highlighting on the front-end. The plugin works great except for one thing. When using the plugin’s code block, the block editor escapes left-facing angle quotes and other characters. For example, if the user enters this in the plugin code block:
cat <<EOF echo "123" EOF
The result is this (both angle brackets are escaped).
I’ve tried everything I can think of, but not able to find a solution. Asking for help here, hopefully someone with more knowledge about blocks will share some clues.
Here is an example of code that works, except for the unwanted escaping. Included in the
save
function:return el('pre', null, el('code', { className: 'language-'+ language }, content));
When I use that, everything works perfectly, except for the escaped characters. The code snippets need to be unescaped in the editor (they are escaped properly on the front-end). Is there *any* way to accomplish this with blocks?
- The topic ‘Help with block element and escaped code’ is closed to new replies.