Is there a way to get tinymce to generate valid html? It's generating lists like this:
<li>text</li>
<li>text</li>
<li>text</li>
<ul>
<li>text</li>
<li>text</li>
<li>text</li>
<ul>
<li>text</li>
<ul>
<li>text</li>
</ul>
</ul>
</ul>
</ul>
Unicorn outputs:
Element ul not allowed as child of element ul in this context.
I'd prefer lists like this:
<ul>
<li>text</li>
<li>text</li>
<li>
text
<ul>
<li>text</li>
<li>text</li>
<li>
text
<ul>
<li>text</li>
</ul>
</li>
</ul>
</li>
</ul>
I was happy to find that this question solved the issue (setting source_formatting
to false
when initializing tinymce); however it seems when tinymce parses some markup (for example if you put some in a textarea and then initilize tinymce) tinymce re-parses it as in example 1. Any ideas on how to make tinymce not change the markup originally in the editor I initialize it on?
Add the lists plugin when initialising TinyMCE
tinyMCE.init({
...
plugins : "lists",
...
});
Edit: I believe this only applies to TinyMCE 3.x
Check the latest version 3.4.4. It should be fixed there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With