W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2018

Re: tidy indent+wrap breaks <pre> formatting

From: Lee <ler762@gmail.com>
Date: Wed, 21 Mar 2018 14:37:07 -0400
Message-ID: <CAD8GWstmSBGiLLsFcjzEvg5Um33A39s+k+8FGZAch1FxeFjeRg@mail.gmail.com>
To: Geoff McLane <ubuntu@geoffair.info>
Cc: html-tidy@w3.org
On 3/19/18, Geoff McLane  wrote:
> Hi Lee,

Hi Geoff,

>  > I don't know git.  Is there some way I can get the code for the
>  > issue-697 branch?
>
> Well knowing `git` is a BIG, LONG, SLOW process. I have been using it
> for years, and would still say I do not `know` git...
>
> But downloading a repository, called a `clone` is easy, and it is shown
> on the github site...

I'm sure..  But documenting it & me understanding the documentation
are two separate things, so thanks for the detailed instructions.

> Concerning your question of a newline after the `<pre>`, this is a
> question with two parts. First what is the W3C recommendation, if you
> can find it in the maze of documentation, and read and understand the
> verbiage there,

That was fairly easy:
https://www.w3.org/TR/html/grouping-content.html#the-pre-element
   In the HTML syntax, a leading newline character immediately
following the pre element start tag is stripped.

What I haven't figured out yet is if
text</pre>
is equivalent to
text
</pre>

> and then there is what is implemented by browsers, and
> this can vary...

Which is why I'd make following the standards the first priority and
only then taking into consideration browser implementations.

> However, in general, a newline in a `<pre>` is honored by most browsers,
> except sometimes the first,

seems like a newline should always _not_ be honored if immediately
following the <pre>

> and in some case any last, but as discussed
> in #158, it seems in all cases it would be **best** for tidy to avoid
> adding it...

If I'm telling tidy to indent and wrap it's because I want to look at
& maybe even edit the html.  Indenting the tags and having them on a
separate line make that much easier.

> As to whether the `<pre>` itself is indented or not, this is more a
> question of `taste` than `correctness`...

Maybe I'm missing something?  If the standard says that no leading spaces
<pre>foo</pre>
is equivalent to many leading spaces
                <pre>foo</pre>
then me telling tidy to indent and it not indenting seems incorrect.

> I really hope you will consider joining github,

I did, so we can continue there if you'd prefer.

Thanks,
Lee
Received on Wednesday, 21 March 2018 18:37:34 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 26 April 2018 16:48:57 UTC