1 .\" $Id: mandoc.1,v 1.56 2010/03/29 10:10:35 kristaps Exp $
3 .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: March 29 2010 $
24 .Nd format and display UNIX manuals
29 .Op Fl f Ns Ar option...
31 .Op Fl O Ns Ar option...
43 manual pages for display. The arguments are as follows:
46 .It Fl f Ns Ar option...
47 Comma-separated compiler options. See
54 for available formats. Defaults to
57 .It Fl O Ns Ar option...
58 Comma-separated output options. See
65 for available formats. Defaults to
69 Print version and exit.
72 Comma-separated warning options. Use
76 for warnings to be considered errors and cause utility
79 arguments may be comma-separated, such as
80 .Fl W Ns Ar error,all .
83 Read input from zero or more
85 If unspecified, reads from stdin. If multiple files are specified,
87 will halt with the first failed parse.
97 text from stdin, implying
124 should only be used for legacy manuals.
129 which is also the default, determines encoding on-the-fly: if the first
136 parser is used; otherwise, the
142 files are specified with
144 each has its file-type determined this way. If multiple files are
149 is specified, then this format is used exclusively.
155 utility accepts the following
162 Produce 7-bit ASCII output, backspace-encoded for bold and underline
163 styles. This is the default. See
167 Produce strict HTML-4.01 output, with a sane default style. See
171 Produce strict XHTML-1.0 output, with a sane default style. See
175 Produce an indented parse tree.
178 Parse only: produce no output.
186 If multiple input files are specified, these will be processed by the
187 corresponding filter in-order.
191 Default compiler behaviour may be overridden with the
196 .It Fl f Ns Ar ign-scope
197 When rewinding the scope of a block macro, forces the compiler to ignore
198 scope violations. This can seriously mangle the resulting tree.
201 .It Fl f Ns Ar ign-escape
202 Ignore invalid escape sequences.
203 This is the default, but the option can be used to override an earlier
206 .It Fl f Ns Ar no-ign-escape
207 Don't ignore invalid escape sequences.
209 .It Fl f Ns Ar no-ign-macro
210 Do not ignore unknown macros at the start of input lines.
212 .It Fl f Ns Ar no-ign-chars
213 Do not ignore disallowed characters.
215 .It Fl f Ns Ar strict
217 .Fl f Ns Ar no-ign-escape ,
218 .Fl f Ns Ar no-ign-macro
220 .Fl f Ns Ar no-ign-chars .
222 .It Fl f Ns Ar ign-errors
223 When parsing multiple files, don't halt when one errors out. Useful
226 over a large set of manuals passed on the command line.
231 For the time being, only
235 accepts output options:
237 .It Fl O Ns Ar style=style.css
240 is used for an external style-sheet. This must be a valid absolute or
242 .It Fl O Ns Ar includes=fmt
247 is used as a template for linked header files (usually via the
251 are replaced with the include filename. The default is not to present a
253 .It Fl O Ns Ar man=fmt
257 .Ar ../html%S/%N.%S.html ,
258 is used as a template for linked manuals (usually via the
264 are replaced with the linked manual's name and section, respectively.
265 If no section is included, section 1 is assumed. The default is not to
271 This section documents output details of
273 In general, output conforms to the traditional manual style of a header,
274 a body composed of sections and sub-sections, and a footer.
276 The text style of output characters (non-macro characters, punctuation,
277 and white-space) is dictated by context.
279 White-space is generally stripped from input. This can be changed with
280 character escapes (specified in
282 or literal modes (specified in
287 If non-macro punctuation is set apart from words, such as in the phrase
288 .Dq to be \&, or not to be ,
291 regardless of output format, according to the following rules: opening
299 is not followed by a space; closing punctuation
312 is not preceded by white-space.
317 however, these rules are also applied to macro arguments when appropriate.
323 which is the default, is rendered in standard 7-bit ASCII documented in
326 Font styles are applied by using back-spaced encoding such that an
330 .Sq _ Ns \e[bs] Ns c ,
333 is the back-space character number 8. Emboldened characters are rendered as
334 .Sq c Ns \e[bs] Ns c .
336 The special characters documented in
338 are rendered best-effort in an ASCII equivalent.
340 Output width is limited to 78 visible columns unless literal input lines
347 conforms to HTML-4.01 strict.
349 Font styles and page structure are applied using CSS2. By default, no
350 font style is applied to any text, although CSS2 is hard-coded to format
351 the basic structure of output.
354 .Pa example.style.css
355 file documents the range of styles applied to output and, if used, will
356 cause rendered documents to appear as they do in
359 Special characters are rendered in decimal-encoded UTF-8.
365 conforms to XHTML-1.0 strict.
369 for details; beyond generating XHTML tags instead of HTML tags, these
370 output modes are identical.
374 To page manuals to the terminal:
377 .D1 % mandoc \-Wall,error \-fstrict mandoc.1 2>&1 | less
378 .D1 % mandoc mandoc.1 mdoc.3 mdoc.7 | less
381 To produce HTML manuals with
385 .D1 % mandoc \-Thtml -Ostyle=style.css mdoc.7 > mdoc.7.html
387 To check over a large set of manuals:
390 .Dl % mandoc \-Tlint \-fign-errors `find /usr/src -name \e*\e.[1-9]`
394 This section summarises
398 Each input and output format is separately noted.
401 .Ss ASCII Compatibility
406 special character doesn't produce expected behaviour in
418 are synonyms, as are \-filled and \-ragged.
426 macro does not underline when scoped under an
428 in the FILES section. This behaves correctly in
432 A list or display following
437 does not assert a prior vertical break, just as it doesn't with
449 Words aren't hyphenated.
452 In normal mode (not a literal block), blocks of spaces aren't preserved,
453 so double spaces following sentence closure are reduced to a single space;
458 Sentences are unilaterally monospaced.
462 .Ss HTML/XHTML Compatibility
467 escape will revert the font to the previous
469 escape, not to the last rendered decoration, which is now dictated by
470 CSS instead of hard-coded. It also will not span past the current
471 scope, for the same reason. Note that in
473 mode, this will work fine.
480 list types render similarly (no break following overreached left-hand
481 side) due to the expressive constraints of HTML.
489 lists render similarly.
501 utility was written by
502 .An Kristaps Dzonsons Aq kristaps@kth.se .
510 CSS2 styling used for
512 input lists does not render properly in older browsers, such as Internet
513 Explorer 6 and earlier.
520 the maximum size of an element attribute is determined by
522 which is usually 1024 bytes. Be aware of this when setting long link
524 .Fl O Ns Ar style=really/long/link .
531 output modes don't render the
533 font size escape documented in
539 Nesting elements within next-line element scopes of
549 and cause them to forget the formatting of the prior next-line scope.
556 should italicise all subsequent text if a line argument is not provided.
557 This behaviour is not implemented.
561 control character is an alias for the standard macro control character
562 and does not emit a line-break as stipulated in GNU troff.