-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tidy removes line breaks inside a pre element containing another element #1006
Comments
On 10/24/21, David-Apps ***@***.***> wrote:
Tidy removes the line breaks from the contents of a pre element when that
element contains another element such as the code element. I expected tidy
to preserve the line breaks inside the pre element (except perhaps a line
break that immediately follows the <pre> tag).
I used HTML Tidy for Linux/x86 version 5.9.17.
looks like a regression -- 5.7.54 does the right thing:
$ tidy /tmp/x.htm
Info: Document content looks like HTML5
No warnings or errors were found.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Cygwin version 5.7.54.next.2021.07.09">
<title>Test</title>
</head>
<body>
<p>This is the <code>Panel</code> constructor:</p>
<pre><code>function Panel(element, canClose, closeHandler) {
this.element = element;
this.canClose = canClose;
this.closeHandler = function () { if (closeHandler) closeHandler() };
}</code></pre>
</body>
</html>
5.9.17 doesn't:
$ ./tidy-html5/build/cmake/tidy.exe /tmp/x.htm
Info: Document content looks like HTML5
No warnings or errors were found.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Cygwin version 5.9.17.2021-10-24">
<title>Test</title>
</head>
<body>
<p>This is the <code>Panel</code> constructor:</p>
<pre><code>function Panel(element, canClose, closeHandler) {
this.element = element; this.canClose = canClose; this.closeHandler =
function () { if (closeHandler) closeHandler() }; }</code></pre>
</body>
</html>
|
I search bug commit by git bisect. I get result.
|
内容をチェックするだけでインデントしない。 workaround: [tidy removes line breaks inside a pre element containing another element · Issue #1006 · htacg/tidy-html5](htacg/tidy-html5#1006)
+1 1. SummaryNewest HTML Tidy versions remove line breaks inside I can’t find, how I can prevent this behavior. 2. ExamplesHTML-Tidy transform blocks of code like this: To such: For languages and markups like YAML, where indentation is required, HTML-Tidy transforms the code into invalid: 3. MCVE
4. Steps to reproduce
5. Behavior5.1. DesiredPreserve line breaks inside 5.2. Current- <div class="SashaBlockHighlight"><pre><span></span><code><span class="nt">kira</span><span class="p">:</span><span class="w"></span>
- <span class="err"> </span><span class="nt">goddess</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span><span class="w"></span>
- </code></pre></div>
+ <div class="SashaBlockHighlight">
+ <pre><code><span class="nt">kira</span><span class="p">:</span> <span class="err"> </span><span class="nt">goddess</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span> </code></pre>
+ </div> HTML-Tidy remove line break inside 6. Environment
Thanks. |
@Kristinita |
@Kristinita |
@Kristinita
And now build as usual. |
This issue is still relevant as of January 2024. Because of this bug users cannot use the features of new versions of Tidy and are forced to downgrade to previous. Thanks. |
Tidy removes the line breaks from the contents of a pre element when that element contains another element such as the code element. I expected tidy to preserve the line breaks inside the pre element (except perhaps a line break that immediately follows the
The text was updated successfully, but these errors were encountered: