Skip to content
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

huge blank space around code block in man page #63

Open
solsticedhiver opened this issue May 9, 2012 · 3 comments
Open

huge blank space around code block in man page #63

solsticedhiver opened this issue May 9, 2012 · 3 comments

Comments

@solsticedhiver
Copy link

when using ronn to get a man page, ronn produce a man page with at least 2 or 3 blank lines around code block

No more than one blank lines is necessary

It seems ronn insert in the man page redondant information like .IP "" 0 followed by a .P which is basically the same.
and other blank line with .

@thinkerbot
Copy link

I looked into this a bit. Turns out lots of manpages have extra blank lines in them but we usually don't see them because the default pager for man will squeeze multiple blank lines into one. To prove this, you could try doing something like:

man -d curl

The last line of output (at least on my machine) is the command that man executes to view the curl man page. For me it's this:

(cd '/usr/share/man' && (echo ".ll 7.8i"; echo ".nr LL 7.8i"; /usr/bin/gunzip -c '/usr/share/man/man1/curl.1.gz') | /usr/bin/tbl | /usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c | (/usr/bin/less -is || true))

If you run that command then you get the same output as man curl. If you modify it so that the -is is missing off of less (-i is for case-insensitive matching and -s is for squeezing blank lines) then you will probably see extra whitespace at the head of the man page. I do.

So I opened pull request #66 to fix this issue. As a workaround, set the PAGER environment variable:

PAGER="less -is" ronn -m ...

Note that since man normally squeezes blank lines already, installing and viewing a manpage generated by ronn should not be affected by this issue.

@harnold
Copy link

harnold commented Sep 8, 2013

I think the correct way to format code blocks would be something like this:

.P
.RS
.nf
\f(CW<line 1>\fP
      ...
\f(CW<line n>\fP
.fi
.RE

where <line 1>, ..., are the lines of the code block. This sets each line in a constant-width font and does not generate superfluous empty lines around the block.

@apjanke
Copy link

apjanke commented Dec 25, 2018

I think tinkerbot's analysis is correct: the extra lines are added by nroff at its rendering stage, downstream from the .roff output. The single-"." lines are empty lines, and are ignored; they're just used for adding space to make your ROFF document readable. They're not causing this.

So the fix needs to be handled at the pager level, by modifying the default pager command. (And, as a user, making sure you don't have your $PAGER or $MANPAGER set to something that lacks the -s.)

Looks like Ronn development is defunct. But I've made a Ronn-NG fork and addressed this issue over there, if you're still interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants