htacg/tidy-html5

tidy moves vim modeline breaking it

konomikitten opened this issue · 0 comments

When I write html I add my vim modeline to the end of the file. For example

index.html

<!DOCTYPE html>
<html>
	<head>
		<title>Title</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1"/>
		<meta name="color-scheme" content="dark light">
	</head>
	<body>
		<p>This is a test</p>
	</body>
</html>

<!-- vim: set tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab: -->

Using tidy on this snippet breaks it though by moving the vim line into the body:

tidy --indent yes --wrap 78 --tidy-mark no index.html

<!DOCTYPE html>
<html>
  <head>
    <title>
      Title
    </title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="color-scheme" content="dark light">
  </head>
  <body>
    <p>
      This is a test
    </p><!-- vim: set tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab: -->
  </body>
</html>

I have checked the parameters for tidy and I can't find anyway to stop it moving my comment. Thoughts?