This is a guide from a lightly-proficient manual writer that’s targeted for beginning users: it’s formatting method is easy and conversion method is basic. This method may also be helpful for those that use github
because it has rendering support for this method. For a more traditional approach, nixCraft has an article
Because it was the authors first effort to write a man page, talk was that it was good to use Pod2Man. Pod2man is an application that converts text using Plain Old Document (POD) formatting to traditional manual (man) pages. POD markup is easy to do and
pod2man is conveniently pre-installed on most Linux distributions (as it is part of the Perl package).
To get a good idea of what to do, here is a basic example demonstrating the formatting (of a fictitious program
dr-smile - output platitudes to help to improve one's mood
dr-smile [B<--happy>] [B<--joke>=F<type>]
B<dr-smile> outputs jokes and happy thoughts designed to make one fell F<--better>. It has the ability to output pleasant thoughts, jokes, good memories, optimistic fortunes... B<dr-smile> I<isn't> a replacement for a professional doctor, please use responsibly and enjoy. Additional options are available in the configuration file F</etc/dr-smile.conf>.
=item B<-h>, B<--happy>
A general happy thought will be output (e.g. C<dr-smile --happy>).
=item B<-j> F<type>, B<--joke>=F<type>
A good-sense joke will be told. The types are: F<knock> and F<oddball>. Read more in B<jokes(1)>.
There is both text formatting and section formatting that is required for a man page.
All the POD text formatting tags needed to know are as follows:
Man pages use two types of formatting (that I’ve ever seen). That are implemented by POD’s bold formatting and PODS filename-or-italic formatting:
|POD Bold formatting
- Program names
|POD Filename formatting
POD Italic formatting
- Occasionally manuals
There are three section tags that are used in
pod2man (that I know of). The
pod2man manual refers to these as Command Paragraphs and they are: header/category sections, item sub-sections, and “over” sub-sub-sections for additional descriptions of item sections. References to all of these are in the above example.
- Header/Category sections are the block descriptors and their contents (like NAME, and DESCRIPTION…).
- Item sections refer to options generally and often override
=over sections for their list item.
- Over sections refer to option descriptions.
General layout structure
Man pages follow a basic (though liberal) structure can be well represented by this:
The name of the command, followed by a one-line description of what it does.
A representative invocation of how to run the command and options it has.
A detailed description of the functioning of the command.
A list of it's options (these are sometimes put in DESCRIPTION).
Some examples of common usage.
List known bugs.
A list of referenced or related commands.
Specifying the contact information.
Specifying the copyright information.
The order of categories varies a bit from man page to man page. The first four categories are almost always the same, however the remaining vary a bit. The above layout is an mnemonic aggregate of category order of the man pages that the author has seen.
Convert pod format to manual page
Pod2man usage is basic:
pod2man dr-smile.pod > dr-smile.1
However, these additional options will probably be wanted to be added, plus compression:
pod2man --section=1 --center="dr-smile manual" --name="dr-smile" --release="1.0" dr-smile.pod | gzip > dr-smile.1.gz