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

Too many empty lines around code #47

Closed
alkisg opened this issue Jul 31, 2019 · 6 comments · Fixed by #113
Closed

Too many empty lines around code #47

alkisg opened this issue Jul 31, 2019 · 6 comments · Fixed by #113

Comments

@alkisg
Copy link

alkisg commented Jul 31, 2019

For the LTSP5 package, we switched our manpage sources from .xml to .md and we started using go-md2man. After Debian Buster was released and its man pages went online, we noticed a problem.

The man pages generated by go-md2man display fine when viewed under man. But when distributions use mandoc to publish them as .html pages online, a lot of empty lines are included in the html output, around the markdown code blocks (and I think elsewhere too).

As an example, see our lts.conf man page, as produced by go-md2man and then published by Debian's mandoc:
https://manpages.debian.org/unstable/ltsp-server/lts.conf.5.en.html

Search for the following line, and see how many empty lines are around it:
FSTAB_1="server:/home /home nfs defaults,nolock 0 0"

Our previous lts.conf manpage, that wasn't using go-md2man, displays a lot less empty lines:
https://manpages.debian.org/unstable/ltsp-docs/lts.conf.5.en.html

Ronn also manages to convert our new markdown-based man pages without extra empty lines, so I believe it's an issue with go-md2man. Thanks!

@alkisg
Copy link
Author

alkisg commented Jul 31, 2019

I'm attaching a screenshot that demonstrates the problem better. It's divided in 4 parts:

normal man output ronn html output
go-md2man with mandoc ronn man output with mandoc

As you can see, the tops ones only have one empty line and are pretty, go-md2man with mandoc has 3 empty lines, and ronn man with mandoc has 2 empty lines.

empty-lines

@cpuguy83
Copy link
Owner

Looking a few things today, I see where we are producing some extra paragraph tags for section headers. Wonder if that's the problem here.

Anyway, if you can provide some source material I can check.

@alkisg
Copy link
Author

alkisg commented Jul 15, 2021

Hello, due to this issue we switched our build scripts to prefer ronn if available, so the only example that I can provide is this old one:

Source: https://bazaar.launchpad.net/~ltsp-upstream/ltsp/ltsp/view/head:/server/man/lts.conf.5.md
Result: https://manpages.debian.org/lts.conf

Thank you very much for your work in this!

@alkisg
Copy link
Author

alkisg commented Jan 7, 2022

I tested go-md2man 2.0.0+ds-5 from Ubuntu 22.04, along with the gnome "yelp" program as a quick alternative to mandoc.

The following input:

```shell
a shell command
```

produced the following output:

.PP
.RS

.nf
a shell command

.fi
.RE

With that output, yelp displays one extra line. If I manually remove the blank line before .fi, the extra line is removed. I'm not sure if that's the same issue that mandoc has or not.

Btw, I still need to run sed -e 's/\\~/~/g;s/\\_/_/g' -i md2man.output to fix the tildes and underscores; I thought #26 had fixed that...

Thank you!

@kolyshkin
Copy link
Contributor

Btw, I still need to run sed -e 's/\\~/~/g;s/\\_/_/g' -i md2man.output to fix the tildes and underscores; I thought #26 had fixed that...

This is off-topic for the issue at hand, and yet:

  1. Tildes were fixed by PR Remove escaping tilde character #56.
  2. Underscores (and some more characters) were fixed by PR Do not escape dash, underscore, and ampersand #74.

The following input:

```shell
a shell command

produced the following output:

.PP
.RS

.nf
a shell command

.fi
.RE

Since PR #95, this has changed to

.EX
a shell command

.EE

Meaning, there is still an extra newline.

@cpuguy83
Copy link
Owner

cpuguy83 commented Feb 5, 2024

I think this should fix it: #113

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

Successfully merging a pull request may close this issue.

3 participants