#42971 closed defect (bug) (worksforme)
Page editor (TinyMCE) strips preformatted code entered inside <pre><code> tags.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.9.1 |
| Component: | TinyMCE | Keywords: | |
| Focuses: | Cc: |
Description
Edit some page or post
Switch editor to text
Enter the following snippet
<pre>
<code>
/* Just for testing purposes */
#include <stdio.h>
main()
{
printf("Hello World");
}
</code>
</pre>
Save, publish or switch to visual
Voila, "<stdio.h>" part is stripped out from both visual editor and page when rendered.
PS: Tested with clean installed WP, no plugins or third party themes, with Chrome, Edge and Safari browsers in Win10 and MacOS X
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @Sakis, don't think this is a bug. In the Text editor you are in HTML context, i.e. you can type HTML tags, attributes, etc. Generally the
<,>, and&characters should be encoded to HTML entities. There are syntax highlighting plugins that do this automatically, best would be to use one of them.