I'm trying to stop TinyMCE modifying my markup. If I put HTML inside a `pre` or `code` tag it removes the `pre` and `code` tags and leaves just the HTML.
So this:
<pre><code class="language-html"><div class="person person--female">
<div class="person__hand person__hand--left person--female__hand"></div>
</div></code></pre>
Becomes this:
<div class="person person--female">
<div class="person__hand person__hand--left person--female__hand"></div>
</div>
I know how to set options for HtmlEditorConfig in _config.php, and this is part of what I currently have:
$tinyMCE->setOptions(array(
'element_format' => 'html',
'valid_elements' => '*- ',
'extended_valid_elements' => '*
- '
));
(FYI - that code above also isn't being formatted correctly. The values should be '* (open square bracket) * (close square bracket)').
I've tried setting various other options to `false`, but nothing makes any difference - `cleanup`, `apply_source_formatting`, `verify_html`
Nothing I try seems to make any difference, other than the `valid_elements` and `extended_valid_elements` settings above. I would be happy if TinyMCE left things alone completely and did no cleanup whatsoever - sometimes being 'helpful' can be too helpful...
I've also looked in the `sapphiremce_cleanup` method, but can't see anything there that might be causing this.
I also know I can use HTML entities instead of actual HTML, but then the code syntax highlighting doesn't work.