json_encode, it should escape most of the characters that would make it break
<?php ob_start(); the_content(); $data = ob_get_contents(); ob_end_clean(); ?> window.the_content = <?php echo json_encode($data); ?>;
You could also just strip out the new lines
window.the_content = "<?php str_replace(" ","",the_content()); ?>";
Note that you would have to do other stuff to make sure it doesnt break, for instance escape double quotes etc.