Skip to content

tidy indent+wrap breaks <pre> formatting #697

@geoffmcl

Description

@geoffmcl

Issue from https://lists.w3.org/Archives/Public/html-tidy/2018JanMar/0016.html

tidy -indent -wrap breaks <pre> formatting if the line is wrapped

<pre>a long line
</pre>

when indented and wrapped ends up like this -

      <pre>
      a long line
</pre>

The pre-formatted text shouldn't have leading spaces added. It should look like

      <pre>
a long line
</pre>

example: using tidy --version HTML Tidy for Cygwin version 5.6.0

run $ tidy -indent -wrap 78 --wrap-attributes yes --tidy-mark no

Input:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>simple test case</title></head><body>
<div><div><div>
<PRE class="SCREEN">x1234567890123456789012345678901234567890123456789
</PRE >
</div></div></div>
</body></html>

Output:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>simple test case</title>
</head>
<body>
  <div>
    <div>
      <div>
        <pre class="SCREEN">
        x1234567890123456789012345678901234567890123456789
</pre>
      </div>
    </div>
  </div>
</body>
</html>

Regards,
Lee

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions