Hello Alejandro,

Alejandro Colomar wrote on Thu, Aug 07, 2025 at 01:04:21PM +0200:

> Do we want to diagnose blank lines in input before TH?
> 
>       alx@debian:~/tmp$ cat blank.man | nl -ba
>            1  
>            2  .TH a 2 d f
>            3  .SH foo
>            4  
>            5  foo
>       alx@debian:~/tmp$ groff -man -Tutf8 -wbreak -rCHECKSTYLE=3 blank.man 
>       an.tmac:blank.man:4: style: blank line in input
> 
>       a(2)                System Calls Manual               a(2)
> 
>       foo
>              foo
> 
>       f                            d                        a(2)
> 
> It seems inconsistent to not diagnose that.

FWIW:

   $ printf "\n.TH\n\n" | mandoc -Tlint
  mandoc: <stdin>:2:2: WARNING: missing manual title, using UNTITLED: TH
  mandoc: <stdin>:2:2: WARNING: missing manual section, using "": TH UNTITLED
  mandoc: <stdin>:2:2: WARNING: missing date, using "": TH

   $ printf "\n.Dd\n\n" | mandoc -Tlint
  mandoc: <stdin>:1:1: WARNING: blank line in fill mode, using .sp
  mandoc: <stdin>:3:1: WARNING: blank line in fill mode, using .sp
  mandoc: <stdin>:2:2: WARNING: missing date, using "": Dd
  mandoc: <stdin>: WARNING: missing manual title, using UNTITLED: EOF
  mandoc: <stdin>: WARNING: missing Os macro, using ""
  mandoc: <stdin>:1:1: WARNING: content before first section header: sp

That is, mandoc(1) only warns about blank lines in mdoc(7) documents,
not in man(7) documents.  The reason is that so far, i judged the average
quality of man(7) documents in the wild low enough that warning about
this minor detail felt too noisy to me.  In typical man(7) documents,
there are bigger fish to fry.

In mdoc(7), on the other hand, it doesn't matter where the blank
line occurs - before the preamble macros, among the preamble
macros, or in the document body.  The mandoc(1) program warns
in any case.  Actually, a blank line *before* the body even
causes two warnings: "blank line in fill mode" and "content before
first section header".

Yours,
  Ingo

Reply via email to