Syntax Highlight and Tinymce4

Asked

Viewed 144 times

1

Whenever I put a JS, PHP or CSS script in tinymce inside the tags <pre>, like Syntax Highlight, it works perfectly, but if I want an HTML script, like tinymce is an HTML editor it removes my tag <pre> and throw HTML out. That way Syntax Highlight cannot read and format the script. How to solve this?

1 answer

1


Tinymce, like all text editors for web page fields, converts the tags, <tag>, into special characters to be displayed in an HTML page.

For example, if you enter the field with the following:

<pre>
     <div>
          Conteúdo da Div
     </div>
</pre>

The result of this field will be:

&lt;pre&gt;
     &lt;div&gt;
          Conteúdo da Div
     &lt;/div&gt;
&lt;/pre&gt;

With this, if you want to display with Syntax Highlight, you would have (either by PHP language, or Javascript or any other you want) set the text within a <pre> tag, so it would be:

<pre>
     &lt;pre&gt;
          &lt;div&gt;
               Conteúdo da Div
          &lt;/div&gt;
     &lt;/pre&gt;
</pre>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.