I am trying to use HTMLTIDY for indentation in my html file. I am using its command line version.
tidy --doctype html5 --tidy-mark no --indent auto --indent-spaces 4 --wrap 0 --write-back yes --output-html yes --drop-empty-elements no filename.html
Its indentation is all correct, except that script tags and inline elements are on the same line instead of indentation.
Before:
<!DOCTYPE html><html><head>
<script type="text/javascript" src="something.js"></script>
<script type="text/javascript" src="something.js"></script>
<script type="text/javascript" src="something.js"></script>
<title>sometitle</title>
</head><body><div class="test"><a href="#">testlink1</a><a href="#">testlink1</a><a href="#">testlink1</a></div></body>
</html>
after
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="something.js">
</script>
<script type="text/javascript" src="something.js">
</script>
<script type="text/javascript" src="something.js">
</script>
<title>sometitle</title>
</head>
<body>
<div class="test">
<a href="#">testlink1</a><a href="#">testlink1</a><a href="#">testlink1</a>
</div>
</body>
</html>
I cannot determine any parameters according to the documentation to fix this. help me solve this.
source
share