Open
Description
Run this brilliant shell script,
D='
<!DOCTYPE html>
<html>
<head>
<title>TEST</title>
</head>
<body>
<p>XX</p>
<pre>YY</pre>
<h2>ZZ</h2>
</body>
</html>
'
{ echo $D | tidy -quiet --vertical-space yes | nl -b a;
echo $D | tidy -quiet --vertical-space yes --indent auto| nl -b a;}|
perl -nwle 'next unless /XX/../ZZ/; print; next unless /ZZ/; print "-" x 22 if !$a++;'
which will print
9 <p>XX</p>
10
11 <pre>YY</pre>
12
13 <h2>ZZ</h2>
----------------------
9 <p>XX</p>
10
11 <pre>YY</pre>
12 <h2>ZZ</h2>
proving that --vertical-space yes --indent auto
will make <PRE>
and
<H2>
too close together.
OK, what if we change 'auto' to 'yes' ? Things get even more 'barfy':
9 <p>XX</p>
10
11 <pre>YY</pre>
12
13 <h2>ZZ</h2>
----------------------
12 XX
13 </p>
14
15 <pre>YY</pre>
16 <h2>
17 ZZ
I.e., despite even more stringent "social distancing" regulations, the
magnetic forces between <PRE>
and <H2>
are just too strong.
HTML Tidy for Linux version 5.6.0