DragonFly On-Line Manual Pages


MANDOC(1)	       DragonFly General Commands Manual	     MANDOC(1)

NAME

mandoc -- format and display UNIX manuals

SYNOPSIS

mandoc [-foption...] [-mformat] [-Ooption...] [-Toutput] [-V] [-Werr...] [infile...]

DESCRIPTION

The mandoc utility formats UNIX manual pages for display. The arguments are as follows: -foption... Comma-separated compiler options. See Compiler Options for details. -mformat Input format. See Input Formats for available formats. Defaults to -mandoc. -Ooption... Comma-separated output options. See Output Options for details. -Toutput Output format. See Output Formats for available formats. Defaults to -Tascii. -V Print version and exit. -Werr... Comma-separated warning options. Use -Wall to print warnings, -Werror for warnings to be considered errors and cause utility termination. Multiple -W arguments may be comma-separated, such as -Werror,all. infile... Read input from zero or more infile. If unspecified, reads from stdin. If multiple files are specified, mandoc will halt with the first failed parse. By default, mandoc reads mdoc(7) or man(7) text from stdin, implying -mandoc, and produces -Tascii output. The mandoc utility exits 0 on success, and >0 if an error occurs. Input Formats The mandoc utility accepts mdoc(7) and man(7) input with -mdoc and -man, respectively. The mdoc(7) format is strongly recommended; man(7) should only be used for legacy manuals. A third option, -mandoc, which is also the default, determines encoding on-the-fly: if the first non-comment macro is `Dd' or `Dt', the mdoc(7) parser is used; otherwise, the man(7) parser is used. If multiple files are specified with -mandoc, each has its file-type determined this way. If multiple files are specified and -mdoc or -man is specified, then this format is used exclusively. Output Formats The mandoc utility accepts the following -T arguments (see OUTPUT): -Tascii Produce 7-bit ASCII output, backspace-encoded for bold and under- line styles. This is the default. See ASCII Output. -Thtml Produce strict HTML-4.01 output, with a sane default style. See HTML Output. -Txhtml Produce strict XHTML-1.0 output, with a sane default style. See XHTML Output. -Ttree Produce an indented parse tree. -Tlint Parse only: produce no output. Implies -Wall and -fstrict. If multiple input files are specified, these will be processed by the corresponding filter in-order. Compiler Options Default compiler behaviour may be overridden with the -f flag. -fign-scope When rewinding the scope of a block macro, forces the compiler to ignore scope violations. This can seriously mangle the resulting tree. (mdoc only) -fign-escape Ignore invalid escape sequences. This is the default, but the option can be used to override an earlier -fstrict. -fno-ign-escape Don't ignore invalid escape sequences. -fno-ign-macro Do not ignore unknown macros at the start of input lines. -fno-ign-chars Do not ignore disallowed characters. -fstrict Implies -fno-ign-escape, -fno-ign-macro and -fno-ign-chars. -fign-errors When parsing multiple files, don't halt when one errors out. Useful with -Tlint over a large set of manuals passed on the com- mand line. Output Options For the time being, only -Thtml and -Txhtml accepts output options: -Ostyle=style.css The file style.css is used for an external style-sheet. This must be a valid absolute or relative URI. -Oincludes=fmt The string fmt, for example, ../src/%I.html, is used as a tem- plate for linked header files (usually via the `In' macro). Instances of `%I' are replaced with the include filename. The default is not to present a hyperlink. -Oman=fmt The string fmt, for example, ../html%S/%N.%S.html, is used as a template for linked manuals (usually via the `Xr' macro). Instances of `%N' and `%S' are replaced with the linked manual's name and section, respectively. If no section is included, sec- tion 1 is assumed. The default is not to present a hyperlink.

OUTPUT

This section documents output details of mandoc. In general, output con- forms to the traditional manual style of a header, a body composed of sections and sub-sections, and a footer. The text style of output characters (non-macro characters, punctuation, and white-space) is dictated by context. White-space is generally stripped from input. This can be changed with character escapes (specified in mandoc_char(7)) or literal modes (speci- fied in mdoc(7) and man(7)). If non-macro punctuation is set apart from words, such as in the phrase ``to be , or not to be'', it's processed by mandoc, regardless of output format, according to the following rules: opening punctuation (`(', `[', and `{') is not followed by a space; closing punctuation (`.', `,', `;', `:', `?', `!', `)', `]' and `}') is not preceded by white-space. If the input is mdoc(7), however, these rules are also applied to macro arguments when appropriate. ASCII Output Output produced by -Tascii, which is the default, is rendered in standard 7-bit ASCII documented in ascii(7). Font styles are applied by using back-spaced encoding such that an under- lined character `c' is rendered as `_\[bs]c', where `\[bs]' is the back- space character number 8. Emboldened characters are rendered as `c\[bs]c'. The special characters documented in mandoc_char(7) are rendered best- effort in an ASCII equivalent. Output width is limited to 78 visible columns unless literal input lines exceed this limit. HTML Output Output produced by -Thtml conforms to HTML-4.01 strict. Font styles and page structure are applied using CSS2. By default, no font style is applied to any text, although CSS2 is hard-coded to format the basic structure of output. The example.style.css file documents the range of styles applied to out- put and, if used, will cause rendered documents to appear as they do in -Tascii. Special characters are rendered in decimal-encoded UTF-8. XHTML Output Output produced by -Txhtml conforms to XHTML-1.0 strict. See HTML Output for details; beyond generating XHTML tags instead of HTML tags, these output modes are identical.

EXAMPLES

To page manuals to the terminal: % mandoc -Wall,error -fstrict mandoc.1 2>&1 | less % mandoc mandoc.1 mdoc.3 mdoc.7 | less To produce HTML manuals with style.css as the style-sheet: % mandoc -Thtml -Ostyle=style.css mdoc.7 > mdoc.7.html To check over a large set of manuals: % mandoc -Tlint -fign-errors `find /usr/src -name \*\.[1-9]`

COMPATIBILITY

This section summarises mandoc compatibility with groff(1). Each input and output format is separately noted. ASCII Compatibility * The `\~' special character doesn't produce expected behaviour in -Tascii. * The `Bd -literal' and `Bd -unfilled' macros of mdoc(7) in -Tascii are synonyms, as are -filled and -ragged. * In groff(1), the `Pa' mdoc(7) macro does not underline when scoped under an `It' in the FILES section. This behaves correctly in mandoc. * A list or display following `Ss' mdoc(7) macro in -Tascii does not assert a prior vertical break, just as it doesn't with `Sh'. * The `na' man(7) macro in -Tascii has no effect. * Words aren't hyphenated. * In normal mode (not a literal block), blocks of spaces aren't pre- served, so double spaces following sentence closure are reduced to a single space; groff(1) retains spaces. * Sentences are unilaterally monospaced. HTML/XHTML Compatibility * The `\fP' escape will revert the font to the previous `\f' escape, not to the last rendered decoration, which is now dictated by CSS instead of hard-coded. It also will not span past the current scope, for the same reason. Note that in ASCII Output mode, this will work fine. * The mdoc(7) `Bl -hang' and `Bl -tag' list types render similarly (no break following overreached left-hand side) due to the expressive constraints of HTML. * The man(7) `IP' and `TP' lists render similarly.

SEE ALSO

man(7), mandoc_char(7), mdoc(7)

AUTHORS

The mandoc utility was written by Kristaps Dzonsons <kristaps@kth.se>.

CAVEATS

The -Thtml and -Txhtml CSS2 styling used for -mdoc input lists does not render properly in older browsers, such as Internet Explorer 6 and ear- lier. In -Thtml and -Txhtml, the maximum size of an element attribute is deter- mined by BUFSIZ, which is usually 1024 bytes. Be aware of this when set- ting long link formats, e.g., -Ostyle=really/long/link. The -Thtml and -Txhtml output modes don't render the `\s' font size escape documented in mdoc(7) and man(7). Nesting elements within next-line element scopes of -man, such as `br' within an empty `B', will confuse -Thtml and -Txhtml and cause them to forget the formatting of the prior next-line scope. The `i' macro in -man should italicise all subsequent text if a line argument is not provided. This behaviour is not implemented. The `'' control character is an alias for the standard macro control character and does not emit a line-break as stipulated in GNU troff. DragonFly 2.7 March 30, 2010 DragonFly 2.7