views:

515

answers:

4

I've currently got TinyMCE incorporated into the backend editor of a simple blogging/page-editing app, but I'm extremely unhappy with the HTML code it creates. It does all sorts of messy things like:

  • Adding inline style information to span tags that you can't ever find to get rid of without editing the HTML directly.
  • Nesting tags in nonsense ways (e.g. <p><strong><p><span>some text</span></p><strong></p> just to make something bold.)
  • Adding empty <p>&nbsp;</p> lines where they don't belong and I'm not trying to create blank lines.

EDIT: I've looked at lists of the other editors out there (including on SO), but I want to know if people firsthand have had better luck getting clean code out of their wysiwyg editors.

Any recommendations for one that outputs better code behind the scenes?

+1  A: 

Use HTML purifier before saving the content into the database.

HTML Purifier

astropanic
+3  A: 

How about a rather drastic alternative, and using a WYMIWYG (What You Mean is What You Get) editor rather that another WYSIWYG editor. That way the author is in full control of the schematic markup as well as the content he/she is entering.

Unfortunately I haven't found one that is as feature rich and usable as tinyMCE, but it seems to have come a long way - see http://www.wymeditor.org/demo/

Vdex
That's a really interesting option! Thanks!
Gabriel Hurley
+2  A: 

You could also look at WMD, which is another WYMIWYG editor:

http://wmd-editor.com/

James Aaron
+1  A: 

I found JoomlaFCK to be a very good alternative to Tiny MCE. Hope you like it. bye

BTW I know it is an old thread but someone might use it. ;)

ecvis17