title: Content Editable Text Editors
body: <p>I have tried out several HTML editors including TinyMCE, CKEditor and now NicEdit.  NicEdit is good in one respect - it is very easy to customize.  However, I have found that they all have a tendency to produce very poor HTML.  Not necessarily so but because they don't do much to correctly interpret invalid user actions such as attempting to style something without first having made a selection.</p>
  
  <p>It is far too easy to end up with HTML that contains something like</p>
  
  <pre><code>&lt;span style='color:#ff0000'&gt;&lt;span style='color:#ff0000'&gt;&lt;span style='color:#ff0000'&gt;Red&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
  </code></pre>
  
  <p>Am I right in thinking that this is pretty much a limitation of the content editable concept?  The poor HTML does not matter much if the purpose is email or posts on forums such as this but gets rather uncomfortable to live with if the generated HTML has to be used in the context of a web page.  If all of this is right what are the alternatives?  Perhaps a Flash based plugin editor that produces better HTML and works harder at interpreting what the user wants to do?</p>
  
  <p>I suppose it would in principle be possible to study the generated output and clean out everything between concertina'd spans if required but that is liable to be quite an undertaking.</p>