Closed p5pRT closed 21 years ago
Since the goal is for this to be an eventual replacement for the current pod2man\, which is one of the better introductions to writing man pages that I've seen\, I'm interested in any comments and feedback on the following:
NOTES For those not sure of the proper layout of a man page\, here are some notes on writing a proper man page.
The name of the program being documented is conventionally written in bold (using B\<>) wherever it occurs\, as are all program options. Arguments should be written in italics (I\<>). Functions are traditionally written in italics; if you write a function as function()\, Pod::Roff will take care of this for you. Literal code or commands should be in C\<>. References to other man pages should be in the form `manpage(section)'\, and Pod::Roff will automatically format those appropriately. As an exception\, it's traditional not to use this form when referring to module documentation; use `L\<Module::Name>' instead.
References to other programs or functions are normally in the form of man page references so that cross-referencing tools can provide the user with links and the like. It's possible to overdo this\, though\, so be careful not to clutter your documentation with too much markup.
The major headers should be set out using a `=head1' directive\, and are historically written in the rather startling ALL UPPER CASE format\, although this is not mandatory. Minor headers may be included using `=head2'\, and are typically in mixed case.
The standard sections of a manual page are:
NAME Mandatory section; should be a comma-separated list of programs or functions documented by this podpage\, such as:
foo\, bar - programs to do something
Manual page indexers are often extremely picky about the format of this section\, so don't put anything in it except this line. A single dash\, and only a single dash\, should separate the list of programs or functions from the description. Functions should not be qualified with `()' or the like. The description should ideally fit on a single line\, even if a man program replaces the dash with a few tabs.
SYNOPSIS A short usage summary for programs and functions. This section is mandatory for section 3 pages.
DESCRIPTION Extended description and discussion of the program or functions\, or the body of the documentation for man pages that document something else. If particularly long\, it's a good idea to break this up into subsections `=head2' directives like:
=head2 A Sample Subection
=head2 Yet Another Sample Subection
OPTIONS Detailed description of each of the command-line options taken by the program. This should be separate from the description for the use of things like Pod::Usage. This is normally presented as a list\, with each option as a separate `=item'. Options should be enclosed in B\<>. Any values that the option takes should be enclosed in I\<>. For example\, the option --section=*manext* would be written:
B\<--section>=I\
Synonymous options (like both the short and long forms) are separated by a comma and a space on the same `=item' line\, or optionally listed as their own item with a reference to the canonical name.
RETURN VALUE What the program or function returns\, if successful. This section can be omitted for programs if they return 0 on success and something non-zero on failure\, as is standard\, and the precise exit codes aren't important.
ERRORS Exceptions\, return codes\, exit stati\, and errno settings. Typically used for function documentation; program documentation uses DIAGNOSTICS instead.
DIAGNOSTICS All possible messages the program can print out--and what they mean. You may wish to follow the same documentation style as the Perl documentation; see perldiag(1) for more details (and look at the POD source as well).
EXAMPLES Give some example uses of the program or function. Don't skimp; users often find this the most useful part of the documentation. The examples are generally given as verbatim paragraphs.
ENVIRONMENT Environment variables that the program cares about\, normally presented as a list using `=over'\, `=item'\, and `=back'. Since environment variables are normally in all uppercase\, no additional special formatting is generally needed; they're glaring enough as it is.
FILES All files used by the program or function\, normally presented as a list\, and what it uses them for. File names should be enclosed in F\<>.
CAVEATS Things to take special care with\, sometimes called WARNINGS.
BUGS Things that are broken or just don't work quite right.
RESTRICTIONS Bugs you don't plan to fix. :-)
NOTES Miscellaneous commentary.
SEE ALSO Other man pages to check out\, like man(1)\, man(7)\, makewhatis(8)\, or catman(8). Normally a simple list of man pages separated by commas\, or a paragraph giving the name of a reference work. Man page references\, if they use the standard `name(section)' form\, don't have to be enclosed in L\<>\, but other things in this section probably should be when appropriate. You may need to use the `L\<...|...>' syntax to keep pod2man and pod2text from being too verbose; see perlpod(1).
AUTHOR Who wrote it (use AUTHORS for multiple people).
HISTORY Programs derived from other sources sometimes have this\, or you might keep a modification log here.
In addition\, some systems use CONFORMING TO to note conformance to relevant standards and MT-LEVEL to note safeness for use in threaded programs or signal handlers. These headings are primarily useful when documenting parts of a C library. Documentation of object-oriented libraries or modules may use CONSTRUCTORS and METHODS sections for detailed documentation of the parts of the library and save the DESCRIPTION section for an overview; other large modules may use FUNCTIONS for similar reasons. Some people use OVERVIEW to summarize the description if it's quite long. Sometimes there's an additional COPYRIGHT section at the bottom\, for licensing terms.
Section ordering varies\, although NAME should *always* be the first section (you'll break some man page systems otherwise)\, and NAME\, SYNOPSIS\, DESCRIPTION\, and OPTIONS generally always occur first and in that order if present. In general\, SEE ALSO\, AUTHOR\, and similar material should be left for last. Some systems also move WARNINGS and NOTES to last. The order given above should be reasonable for most purposes.
For additional information that may be more accurate for your specific system\, see either man(5) or man(7) depending on your system manual section numbering conventions.
-- Russ Allbery (rra@stanford.edu) \<URL:http://www.eyrie.org/~eagle/>
@iabyn - Status changed from 'stalled' to 'resolved'
Migrated from rt.perl.org#1368 (status was 'resolved')
Searchable as RT1368$