1 .\" Id: mandoc.1,v 1.103 2013/07/13 19:41:16 schwarze Exp
3 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
6 .\" Permission to use, copy, modify, and distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 .Nd format and display UNIX manuals
28 .Op Fl I Cm os Li = Ar name
40 manual pages for display.
48 text from stdin, implying
54 The arguments are as follows:
57 .It Fl I Cm os Li = Ar name
59 Override the default operating system
69 for available formats.
73 Comma-separated output options.
78 for available formats.
82 Print version and exit.
84 Specify the minimum message
86 to be reported on the standard error output and to affect the exit status.
109 to exit after parsing a file that causes warnings or errors of at least
111 No formatted output will be produced from that file.
116 are requested, they can be joined with a comma, for example
117 .Fl W Ns Cm error , Ns Cm stop .
119 Read input from zero or more files.
120 If unspecified, reads from stdin.
121 If multiple files are specified,
123 will halt with the first failed parse.
143 should only be used for legacy manuals.
147 which is also the default, determines encoding on-the-fly: if the first
154 parser is used; otherwise, the
159 files are specified with
161 each has its file-type determined this way.
162 If multiple files are
167 is specified, then this format is used exclusively.
171 utility accepts the following
173 arguments, which correspond to output modes:
174 .Bl -tag -width "-Tlocale"
176 Produce 7-bit ASCII output.
181 Produce strict CSS1/HTML-4.01 output.
185 Parse only: produce no output.
187 .Fl W Ns Cm warning .
188 .It Fl T Ns Cm locale
189 Encode output using the current locale.
203 Produce PostScript output.
205 .Sx PostScript Output .
207 Produce an indented parse tree.
209 Encode output in the UTF\-8 multi-byte format.
213 Produce strict CSS1/XHTML-1.0 output.
218 If multiple input files are specified, these will be processed by the
219 corresponding filter in-order.
223 which is the default, is rendered in standard 7-bit ASCII documented in
226 Font styles are applied by using back-spaced encoding such that an
230 .Sq _ Ns \e[bs] Ns c ,
233 is the back-space character number 8.
234 Emboldened characters are rendered as
235 .Sq c Ns \e[bs] Ns c .
237 The special characters documented in
239 are rendered best-effort in an ASCII equivalent.
240 If no equivalent is found,
244 Output width is limited to 78 visible columns unless literal input lines
249 arguments are accepted:
251 .It Cm indent Ns = Ns Ar indent
252 The left margin for normal text is set to
254 blank characters instead of the default of five for
258 Increasing this is not recommended; it may result in degraded formatting,
259 for example overfull lines or ugly line breaks.
260 .It Cm width Ns = Ns Ar width
261 The output width is set to
263 which will normalise to \(>=60.
268 conforms to HTML-4.01 strict.
271 .Pa example.style.css
272 file documents style-sheet classes available for customising output.
273 If a style-sheet is not specified with
276 defaults to simple output readable in any graphical or text-based web
279 Special characters are rendered in decimal-encoded UTF\-8.
283 arguments are accepted:
293 elements and only emit the subtree below the
298 argument will be ignored.
299 This is useful when embedding manual content within existing documents.
300 .It Cm includes Ns = Ns Ar fmt
305 is used as a template for linked header files (usually via the
310 are replaced with the include filename.
311 The default is not to present a
313 .It Cm man Ns = Ns Ar fmt
317 .Ar ../html%S/%N.%S.html ,
318 is used as a template for linked manuals (usually via the
325 are replaced with the linked manual's name and section, respectively.
326 If no section is included, section 1 is assumed.
327 The default is not to
329 .It Cm style Ns = Ns Ar style.css
332 is used for an external style-sheet.
333 This must be a valid absolute or
337 Locale-depending output encoding is triggered with
339 This option is not available on all systems: systems without locale
340 support, or those whose internal representation is not natively UCS-4,
345 for font style specification and available command-line arguments.
347 Translate input format into
350 This is useful for distributing manual sources to legacy systems
357 is passed as input, it is translated into
359 If the input format is
361 the input is copied to the output, expanding any
365 The parser is also run, and as usual, the
369 are displayed before copying the input to the output.
371 PDF-1.1 output may be generated by
374 .Sx PostScript Output
377 arguments and defaults.
378 .Ss PostScript Output
381 Level-2 pages may be generated by
383 Output pages default to letter sized and are rendered in the Times font
385 Margins are calculated as 1/9 the page length and width.
388 Special characters are rendered as in
393 arguments are accepted:
395 .It Cm paper Ns = Ns Ar name
405 You may also manually specify dimensions as
407 width by height in millimetres.
408 If an unknown value is encountered,
415 to force a UTF\-8 locale.
418 for details and options.
422 conforms to XHTML-1.0 strict.
426 for details; beyond generating XHTML tags instead of HTML tags, these
427 output modes are identical.
431 utility exits with one of the following values, controlled by the message
437 .Bl -tag -width Ds -compact
439 No warnings or errors occurred, or those that did were ignored because
440 they were lower than the requested
443 At least one warning occurred, but no error, and
447 At least one parsing error occurred, but no fatal error, and
453 A fatal parsing error occurred.
455 Invalid command line arguments were specified.
456 No input files have been read.
458 An operating system error occurred, for example memory exhaustion or an
459 error accessing input files.
462 to exit at once, possibly in the middle of parsing or formatting a file.
468 .Fl W Ns Cm warning .
470 To page manuals to the terminal:
472 .Dl $ mandoc \-Wall,stop mandoc.1 2\*(Gt&1 | less
473 .Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
475 To produce HTML manuals with
479 .Dl $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
481 To check over a large set of manuals:
483 .Dl $ mandoc \-Tlint `find /usr/src -name \e*\e.[1-9]`
485 To produce a series of PostScript manuals for A4 paper:
487 .Dl $ mandoc \-Tps \-Opaper=a4 mdoc.7 man.7 \*(Gt manuals.ps
493 format, for use on systems lacking an
497 .Dl $ mandoc \-Tman foo.mdoc \*(Gt foo.man
499 Standard error messages reporting parsing errors are prefixed by
502 .D1 Ar file : line : column : \ level :
505 where the fields have the following meanings:
506 .Bl -tag -width "column"
508 The name of the input file causing the message.
510 The line number in that input file.
511 Line numbering starts at 1.
513 The column number in that input file.
514 Column numbering starts at 1.
515 If the issue is caused by a word, the column number usually
516 points to the first character of the word.
518 The message level, printed in capital letters.
521 Message levels have the following meanings:
522 .Bl -tag -width "warning"
524 The parser is unable to parse a given input file at all.
525 No formatted output is produced from that input file.
527 An input file contains syntax that cannot be safely interpreted,
528 either because it is invalid or because
530 does not implement it yet.
531 By discarding part of the input or inserting missing tokens,
532 the parser is able to continue, and the error does not prevent
533 generation of formatted output, but typically, preparing that
534 output involves information loss, broken document structure
535 or unintended formatting.
537 An input file uses obsolete, discouraged or non-portable syntax.
538 All the same, the meaning of the input is unambiguous and a correct
539 rendering can be produced.
540 Documents causing warnings may render poorly when using other
541 formatting tools instead of
549 levels are hidden unless their level, or a lower level, is requested using a
557 utility may also print messages related to invalid command line arguments
558 or operating system errors, for example when memory is exhausted or
559 input files cannot be read.
560 Such messages do not carry the prefix described above.
562 This section summarises
564 compatibility with GNU troff.
565 Each input and output format is separately noted.
566 .Ss ASCII Compatibility
569 Unrenderable unicode codepoints specified with
571 escapes are printed as
574 In GNU troff, these raise an error.
584 are synonyms, as are \-filled and \-ragged.
586 In historic GNU troff, the
589 macro does not underline when scoped under an
591 in the FILES section.
592 This behaves correctly in
595 A list or display following the
600 does not assert a prior vertical break, just as it doesn't with
610 Words aren't hyphenated.
612 .Ss HTML/XHTML Compatibility
617 escape will revert the font to the previous
619 escape, not to the last rendered decoration, which is now dictated by
620 CSS instead of hard-coded.
621 It also will not span past the current scope,
625 mode, this will work fine.
632 list types render similarly (no break following overreached left-hand
633 side) due to the expressive constraints of HTML.
640 lists render similarly.
652 utility was written by
653 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
659 the maximum size of an element attribute is determined by
661 which is usually 1024 bytes.
662 Be aware of this when setting long link
664 .Fl O Ns Cm style Ns = Ns Ar really/long/link .
666 Nesting elements within next-line element scopes of
676 and cause them to forget the formatting of the prior next-line scope.
680 control character is an alias for the standard macro control character
681 and does not emit a line-break as stipulated in GNU troff.