WordPress get_the_content WITH formatting

global $post;
ob_start();
the_content();
$output = ob_get_contents();
ob_end_clean();

Source: WordPress › Support » get_the_content WITH formatting