aramk / crayon-syntax-highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
https://wordpress.org/plugins/crayon-syntax-highlighter/
GNU General Public License v3.0
1.1k stars 248 forks source link

HTML code highlighting lost, converted to normal HTML code #277

Open RobinRoelofsen opened 9 years ago

RobinRoelofsen commented 9 years ago

Hi there,

Love the plugin, and works wonders most of the time. Somehow there are some issues when using TinyMCE Advanced.

When I add HTML code to the tag editor and set the language to XHTML and save the post with the editor in visual mode, everything works. When I switch to Text mode and save, pre tags disappear and the code is seen as normal HTML code.

This does not happen with CSS or PHP (the other two languages I checked).

Not the desired behavior, I'm sure. As long as I do not save when in Text mode, it all works.

Any idea why this happens?

Thanks in advance!

Robin Roelofsen The Netherlands

aramk commented 9 years ago

Hi there, I'm not able to reproduce this issue. Adding HTML code in the visual editor and switching between Visual and HTML modes doesn't cause any issues. Visual:

<html></html>

HTML:

<pre class="lang:xhtml decode:true" title="Test">&lt;html&gt;&lt;/html&gt;</pre>
&nbsp;

Are you seeing something different?

RobinRoelofsen commented 9 years ago

Okay, what I do:

I place the HTML in the Crayon editor (using Dutch language version):

1

Looks like this in the editor in WP using TinyMCE Advanced:

2

Switch to Text mode (maybe for some other changes) and save it while in Text mode:

3

After saving, switching back to the visual editor, shows the result of the HTML code instead of the box containing the code:

4

Switching back to Text mode, all Crayon code has been stripped:

5

When I test the exact same, but now using CSS code, it works.

Even when I use HTML code and selecting language CSS, the above happens, so apparently the code is seen as actual code, not as code in a Crayon box.

aramk commented 9 years ago

Hmm, what version of Wordpress are you using?

RobinRoelofsen commented 9 years ago

WordPress version 4.2.2 Crayon Syntax Highlighter version 2.7.1 TinyMCE Advanced version 4.1.9