1 .\" $Vendor-Id: mandoc.1,v 1.100 2011/12/25 19:35:44 kristaps Exp $
3 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
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.
22 .Nd format and display UNIX manuals
36 manual pages for display.
44 text from stdin, implying
50 The arguments are as follows:
56 for available formats.
60 Comma-separated output options.
65 for available formats.
69 Print version and exit.
71 Specify the minimum message
73 to be reported on the standard error output and to affect the exit status.
96 to exit after parsing a file that causes warnings or errors of at least
98 No formatted output will be produced from that file.
103 are requested, they can be joined with a comma, for example
104 .Fl W Ns Cm error , Ns Cm stop .
106 Read input from zero or more files.
107 If unspecified, reads from stdin.
108 If multiple files are specified,
110 will halt with the first failed parse.
130 should only be used for legacy manuals.
134 which is also the default, determines encoding on-the-fly: if the first
141 parser is used; otherwise, the
146 files are specified with
148 each has its file-type determined this way.
149 If multiple files are
154 is specified, then this format is used exclusively.
158 utility accepts the following
160 arguments, which correspond to output modes:
161 .Bl -tag -width "-Tlocale"
163 Produce 7-bit ASCII output.
168 Produce strict CSS1/HTML-4.01 output.
172 Parse only: produce no output.
174 .Fl W Ns Cm warning .
175 .It Fl T Ns Cm locale
176 Encode output using the current locale.
190 Produce PostScript output.
192 .Sx PostScript Output .
194 Produce an indented parse tree.
196 Encode output in the UTF\-8 multi-byte format.
200 Produce strict CSS1/XHTML-1.0 output.
205 If multiple input files are specified, these will be processed by the
206 corresponding filter in-order.
210 which is the default, is rendered in standard 7-bit ASCII documented in
213 Font styles are applied by using back-spaced encoding such that an
217 .Sq _ Ns \e[bs] Ns c ,
220 is the back-space character number 8.
221 Emboldened characters are rendered as
222 .Sq c Ns \e[bs] Ns c .
224 The special characters documented in
226 are rendered best-effort in an ASCII equivalent.
227 If no equivalent is found,
231 Output width is limited to 78 visible columns unless literal input lines
236 arguments are accepted:
238 .It Cm indent Ns = Ns Ar indent
239 The left margin for normal text is set to
241 blank characters instead of the default of five for
245 Increasing this is not recommended; it may result in degraded formatting,
246 for example overfull lines or ugly line breaks.
247 .It Cm width Ns = Ns Ar width
248 The output width is set to
250 which will normalise to \(>=60.
255 conforms to HTML-4.01 strict.
258 .Pa example.style.css
259 file documents style-sheet classes available for customising output.
260 If a style-sheet is not specified with
263 defaults to simple output readable in any graphical or text-based web
266 Special characters are rendered in decimal-encoded UTF\-8.
270 arguments are accepted:
280 elements and only emit the subtree below the
285 argument will be ignored.
286 This is useful when embedding manual content within existing documents.
287 .It Cm includes Ns = Ns Ar fmt
292 is used as a template for linked header files (usually via the
297 are replaced with the include filename.
298 The default is not to present a
300 .It Cm man Ns = Ns Ar fmt
304 .Ar ../html%S/%N.%S.html ,
305 is used as a template for linked manuals (usually via the
312 are replaced with the linked manual's name and section, respectively.
313 If no section is included, section 1 is assumed.
314 The default is not to
316 .It Cm style Ns = Ns Ar style.css
319 is used for an external style-sheet.
320 This must be a valid absolute or
324 Locale-depending output encoding is triggered with
326 This option is not available on all systems: systems without locale
327 support, or those whose internal representation is not natively UCS-4,
332 for font style specification and available command-line arguments.
334 Translate input format into
337 This is useful for distributing manual sources to legancy systems
344 is passed as input, it is translated into
346 If the input format is
348 the input is copied to the output, expanding any
352 The parser is also run, and as usual, the
356 are displayed before copying the input to the output.
358 PDF-1.1 output may be generated by
361 .Sx PostScript Output
364 arguments and defaults.
365 .Ss PostScript Output
368 Level-2 pages may be generated by
370 Output pages default to letter sized and are rendered in the Times font
372 Margins are calculated as 1/9 the page length and width.
375 Special characters are rendered as in
380 arguments are accepted:
382 .It Cm paper Ns = Ns Ar name
392 You may also manually specify dimensions as
394 width by height in millimetres.
395 If an unknown value is encountered,
402 to force a UTF\-8 locale.
405 for details and options.
409 conforms to XHTML-1.0 strict.
413 for details; beyond generating XHTML tags instead of HTML tags, these
414 output modes are identical.
418 utility exits with one of the following values, controlled by the message
424 .Bl -tag -width Ds -compact
426 No warnings or errors occurred, or those that did were ignored because
427 they were lower than the requested
430 At least one warning occurred, but no error, and
434 At least one parsing error occurred, but no fatal error, and
440 A fatal parsing error occurred.
442 Invalid command line arguments were specified.
443 No input files have been read.
445 An operating system error occurred, for example memory exhaustion or an
446 error accessing input files.
449 to exit at once, possibly in the middle of parsing or formatting a file.
455 .Fl W Ns Cm warning .
457 To page manuals to the terminal:
459 .Dl $ mandoc \-Wall,stop mandoc.1 2\*(Gt&1 | less
460 .Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
462 To produce HTML manuals with
466 .Dl $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
468 To check over a large set of manuals:
470 .Dl $ mandoc \-Tlint `find /usr/src -name \e*\e.[1-9]`
472 To produce a series of PostScript manuals for A4 paper:
474 .Dl $ mandoc \-Tps \-Opaper=a4 mdoc.7 man.7 \*(Gt manuals.ps
480 format, for use on systems lacking an
484 .Dl $ mandoc \-Tman foo.mdoc \*(Gt foo.man
486 Standard error messages reporting parsing errors are prefixed by
489 .D1 Ar file : line : column : \ level :
492 where the fields have the following meanings:
493 .Bl -tag -width "column"
495 The name of the input file causing the message.
497 The line number in that input file.
498 Line numbering starts at 1.
500 The column number in that input file.
501 Column numbering starts at 1.
502 If the issue is caused by a word, the column number usually
503 points to the first character of the word.
505 The message level, printed in capital letters.
508 Message levels have the following meanings:
509 .Bl -tag -width "warning"
511 The parser is unable to parse a given input file at all.
512 No formatted output is produced from that input file.
514 An input file contains syntax that cannot be safely interpreted,
515 either because it is invalid or because
517 does not implement it yet.
518 By discarding part of the input or inserting missing tokens,
519 the parser is able to continue, and the error does not prevent
520 generation of formatted output, but typically, preparing that
521 output involves information loss, broken document structure
522 or unintended formatting.
524 An input file uses obsolete, discouraged or non-portable syntax.
525 All the same, the meaning of the input is unambiguous and a correct
526 rendering can be produced.
527 Documents causing warnings may render poorly when using other
528 formatting tools instead of
536 levels are hidden unless their level, or a lower level, is requested using a
544 utility may also print messages related to invalid command line arguments
545 or operating system errors, for example when memory is exhausted or
546 input files cannot be read.
547 Such messages do not carry the prefix described above.
549 This section summarises
551 compatibility with GNU troff.
552 Each input and output format is separately noted.
553 .Ss ASCII Compatibility
556 Unrenderable unicode codepoints specified with
558 escapes are printed as
561 In GNU troff, these raise an error.
571 are synonyms, as are \-filled and \-ragged.
573 In historic GNU troff, the
576 macro does not underline when scoped under an
578 in the FILES section.
579 This behaves correctly in
582 A list or display following the
587 does not assert a prior vertical break, just as it doesn't with
597 Words aren't hyphenated.
599 .Ss HTML/XHTML Compatibility
604 escape will revert the font to the previous
606 escape, not to the last rendered decoration, which is now dictated by
607 CSS instead of hard-coded.
608 It also will not span past the current scope,
612 mode, this will work fine.
619 list types render similarly (no break following overreached left-hand
620 side) due to the expressive constraints of HTML.
627 lists render similarly.
639 utility was written by
640 .An Kristaps Dzonsons ,
641 .Mt kristaps@bsd.lv .
647 the maximum size of an element attribute is determined by
649 which is usually 1024 bytes.
650 Be aware of this when setting long link
652 .Fl O Ns Cm style Ns = Ns Ar really/long/link .
654 Nesting elements within next-line element scopes of
664 and cause them to forget the formatting of the prior next-line scope.
668 control character is an alias for the standard macro control character
669 and does not emit a line-break as stipulated in GNU troff.