Can't figure out how to preserve blank line


#1

I have embedded JS code in my html file as follows:

		<script type="text/javascript">
			'use strict';

			$(document).ready(function() {

			});
		</script>

I like to have a blank line after the beginning script tag and before the ending script tag. However, every time I save the file, the blank line is always removed. I’ve tried everything I could find by googling and have added the following to the config file for CSS, HTML, and JavaScript: preserve_newlines:true

Nothing seems to work. Blank lines are being preserved in my CSS, HTML, and standalone JavaScript files. Not sure why it’s not working with JavaScript that’s embedded in my HTML file. Not being able to resolve this is really frustating me.


#2

Do you have atom-beautify installed?


#3

Thanks for the quick reply!

Yes. I figured out that I can create any kind of newlines within the embedded JS tags and they will be preserved. It just won’t preserve any newlines after the tag. Certainly not a deal breaker, and something I can definitely live with.


#4

If it’s trailing white space at the end of the document, look at the built in whitespace package.


#5

You can uncheck the Beautify On Save package in the atom-beautify settings (Settings -> Packages -> atom-beautify) for your specific language. I’m not sure if embedded JS in an HTML file would be governed by the HTML or JavaScript settings, so you may have to check both.