the_content
doesn’t affect the DOCTYPE
and <html>
tags, only the post/page content.
One of your plugins, or something else in the theme is either throwing an error, or is printing something earlier than it should.
Have you tried:
- Disabling each plugin one by one and see when it is fixed.
- Editing wp-config.php and adding
define( 'WP_DEBUG', true );
to look for errors