While it's cool to have ckeditor apply some cleanup, it shouldn't get carried away. A good measure of this would be that perfectly good markup should be left untouched so that it can be edited repeatedly without there being a buildup of markup, neither wrapping it nor adding to it.
Here's a simple exercise in 3.6.3:
After 3 iterations, that simple and perfectly reasonable markup turns into this monstrosity:
Is there some way of preventing CKEditor adding in all this extra markup?
Here's a simple exercise in 3.6.3:
- Enter this raw HTML into a ckeditor in source mode:
<h1>Title</h1> <h2>Subtitle</h2> <p>Some text</p>
- Flip to visual mode
- Repeat this sequence a few times:
- Select all
- Cut
- Paste
- View source and witness the hideous markup explosion
After 3 iterations, that simple and perfectly reasonable markup turns into this monstrosity:
<h1> </h1> <div style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #222222; background-color: #ffffff; "> <h1> </h1> <div style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #222222; background-color: #ffffff; "> <h1> </h1> <br> <div> <div style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #222222; background-color: #ffffff; "> <h1> </h1> <div style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #222222; background-color: #ffffff; "> <h1> </h1> <div style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #222222; background-color: #ffffff; "> <div style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #222222; background-color: #ffffff; "> <h1>Title</h1> <h2>Subtitle</h2> <p>Some text</p> <div> </div> </div> </div> </div> </div> </div> </div> </div> <p> </p>
Is there some way of preventing CKEditor adding in all this extra markup?

Re: CKEditor generates excessive markup
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Re: CKEditor generates excessive markup
On Mac OS X 10.7.4.
Firefox 12: As the result you posted - I can live with a little extra white-space, though it would be better if that wasn't added - I'm often editing content for old renderers that are whitespace-sensitive.
Chrome 19 a similar result to Firefox, but adds in "<h1> </h1>" before it.
Opera 11.63 same markup as Chrome but all text gets progressively bigger each time you paste, even outside H1 tags.
Safari 5.1.7 does the same exploding markup thing I get in my ckeditor.
On Windows XP:
IE 8: Same result as Mac Firefox.
Safari 5.1.7 does the same as the Mac version, i.e. explodes.
I also managed to reproduce it on my iPhone, where Safari caused a similar explosion.
So, it's mainly a problem in Safari, but Chrome and Opera don't play nice either. Definitely not a feature!
Re: CKEditor generates excessive markup
Developmentas described here
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!