js-beautify icon indicating copy to clipboard operation
js-beautify copied to clipboard

Preserve Existing Newlines

Open johnaweiss opened this issue 2 years ago • 1 comments

Description

Preserve all newlines in existing HTML.

Input

With this requested feature, this input:

<body>

	<!-- Some Comments --->

	<!-------------- CONTAINER: GROUP CONTAINER 1  ------------------->
	<span data-header="team-members" data-meta="
	TITLE: Product Management
	RECORDS: advisers-prod-mgmt
	ITEM-CLASS: team-member
	">
</span>
	<hr>

</body>

Expected Output

Should give this output:

<body>
  
	<!-- Some Comments --->
  
	<!-------------- CONTAINER: GROUP CONTAINER 1  ------------------->
	<span data-header="team-members" data-meta="
		TITLE: Product Management
		RECORDS: advisers-prod-mgmt
		ITEM-CLASS: team-member
		">
	</span>
	<hr>
  
</body>

Environment

OS: Online

Also, attributes on newlines should get indented, as shown above.

johnaweiss avatar Dec 13 '22 18:12 johnaweiss

Another example. Newlines in the following should be preserved. They aren't preserved. As a result, my javascript process is broken, because it relies on those newlines.

<span hidden id="advisers-prod-mgmt">
	NAME
	IMG
	LINK
	BIO
	
	Lana Hogue
	lana-hogue.jpg
	https://www.garmentindustry411.com/
	is a sewn-products supply chain guru. 
	
	Faran Thomason
	faran.jpg
	https://about.me/faran_thomason
	is a toy and video game industry veteran.
</span>

Basically, i seek an "Indent Only" beautifier.

johnaweiss avatar Dec 13 '22 19:12 johnaweiss