I am using following command to format HTML:
tidy -xml --merge-divs no --wrap 0 --force-output yes --indent auto --indent-spaces 2 --quiet yes
It works fine except it automatically closes tags like this:
<br> -> <br></br>
<br><br> -> <br><br></br></br>
<div><input><span></span></div> -> <div><input><span></span></input></div>
As you can see it tries to close every tag - how I can fore it not to do that and leave tags untouched or at least close them "inline" like this:
<br><br> -> <br/><br/>
The closest I want is using this command:
tidy -asxhtml --hide-endtags yes --doctype omit --merge-divs no --wrap 0 --force-output yes --indent auto --indent-spaces 2 --quiet yes
However from this HTML:
<div><input type="text"><span>abc</span></div><br><br>
It generates this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.12), see www.w3.org" />
<title></title>
</head>
<body>
<div>
<input type="text" /><span>abc</span>
</div><br />
<br />
</body>
</html>
- I dont want html, meta, body etc tags to be autmatically added
- I dont want br and input tags to be auto closed
- why span is in the same line as input?
- Why br is in the same line as
</div>
?
I found option show-body-only
which does not output html, body, etc tags.
However still output is like this:
<div>
<input type="text" /><span>abc</span>
</div><br />
<br />
- I dont want input/br tags to be auto closed
- I dont want span to be in the same line as input
- I dont want br to be on the same line as div close tag