Skip to content

Man writer: use default middle header when calling .TH when metadata does not include one #9943

Closed
@dimztimz

Description

@dimztimz

Explain the problem.

The following input:

---
title: HELLO
section: 1
---

# DESCRIPTION

hello world

Using the following command line: pandoc --from markdown --to man --standalone

Produces the following output:

.TH "HELLO" "1" "" "" ""
.SH DESCRIPTION
hello world

What I expect is that the last argument to the .TH macro to be omitted:

.TH "HELLO" "1" "" ""

Pandoc version?

Tested with v3.1.3, but also on online version

Rationale

The .TH macro has some optional arguments. See groff_man(7) and man-pages(7). If the last argument is omitted, the header in the rendered man-page will be the default one which depends on the section number. See relevant quotes:

.TH identifier section [footer-middle [footer-inside [header-middle]]]
...
header-middle is centered in the header. If section is an integer between 1 and 9 (inclusive), there is no need to specify header-middle; an.tmac will supply text for it.

The first command in a man page should be a TH command:

.TH title section date source manual-section
...
manual-section: Normally, this should be empty, since the default value will be good.

More insight

See following line in the template for standalone output:

.TH "$title/nowrap$" "$section/nowrap$" "$date/nowrap$" "$footer/nowrap$" "$header/nowrap$"

Is it possible to change this so that if the variable header is undefined, then the last argument is omitted instead of writing empty double quotes ("")?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions