1 .\" $Id: mandoc.1,v 1.99 2011/11/13 14:50:54 schwarze 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.
17 .Dd $Mdocdate: November 13 2011 $
22 .Nd format and display UNIX manuals
36 manual pages for display.
37 The arguments are as follows:
43 for available formats.
47 Comma-separated output options.
52 for available formats.
56 Print version and exit.
58 Specify the minimum message
60 to be reported on the standard error output and to affect the exit status.
83 to exit after parsing a file that causes warnings or errors of at least
85 No formatted output will be produced from that file.
90 are requested, they can be joined with a comma, for example
91 .Fl W Ns Cm error , Ns Cm stop .
93 Read input from zero or more files.
94 If unspecified, reads from stdin.
95 If multiple files are specified,
97 will halt with the first failed parse.
106 text from stdin, implying
129 should only be used for legacy manuals.
133 which is also the default, determines encoding on-the-fly: if the first
140 parser is used; otherwise, the
145 files are specified with
147 each has its file-type determined this way.
148 If multiple files are
153 is specified, then this format is used exclusively.
157 utility accepts the following
159 arguments, which correspond to output modes:
160 .Bl -tag -width "-Tlocale"
162 Produce 7-bit ASCII output.
167 Produce strict CSS1/HTML-4.01 output.
171 Parse only: produce no output.
173 .Fl W Ns Cm warning .
174 .It Fl T Ns Cm locale
175 Encode output using the current locale.
189 Produce PostScript output.
191 .Sx PostScript Output .
193 Produce an indented parse tree.
195 Encode output in the UTF\-8 multi-byte format.
199 Produce strict CSS1/XHTML-1.0 output.
204 If multiple input files are specified, these will be processed by the
205 corresponding filter in-order.
209 which is the default, is rendered in standard 7-bit ASCII documented in
212 Font styles are applied by using back-spaced encoding such that an
216 .Sq _ Ns \e[bs] Ns c ,
219 is the back-space character number 8.
220 Emboldened characters are rendered as
221 .Sq c Ns \e[bs] Ns c .
223 The special characters documented in
225 are rendered best-effort in an ASCII equivalent.
226 If no equivalent is found,
230 Output width is limited to 78 visible columns unless literal input lines
235 arguments are accepted:
237 .It Cm indent Ns = Ns Ar indent
238 The left margin for normal text is set to
240 blank characters instead of the default of five for
244 Increasing this is not recommended; it may result in degraded formatting,
245 for example overfull lines or ugly line breaks.
246 .It Cm width Ns = Ns Ar width
247 The output width is set to
249 which will normalise to \(>=60.
254 conforms to HTML-4.01 strict.
257 .Pa example.style.css
258 file documents style-sheet classes available for customising output.
259 If a style-sheet is not specified with
262 defaults to simple output readable in any graphical or text-based web
265 Special characters are rendered in decimal-encoded UTF\-8.
269 arguments are accepted:
279 elements and only emit the subtree below the
284 argument will be ignored.
285 This is useful when embedding manual content within existing documents.
286 .It Cm includes Ns = Ns Ar fmt
291 is used as a template for linked header files (usually via the
296 are replaced with the include filename.
297 The default is not to present a
299 .It Cm man Ns = Ns Ar fmt
303 .Ar ../html%S/%N.%S.html ,
304 is used as a template for linked manuals (usually via the
311 are replaced with the linked manual's name and section, respectively.
312 If no section is included, section 1 is assumed.
313 The default is not to
315 .It Cm style Ns = Ns Ar style.css
318 is used for an external style-sheet.
319 This must be a valid absolute or
323 Locale-depending output encoding is triggered with
325 This option is not available on all systems: systems without locale
326 support, or those whose internal representation is not natively UCS-4,
331 for font style specification and available command-line arguments.
333 Translate input format into
336 This is useful for distributing manual sources to legancy systems
343 is passed as input, it is translated into
345 If the input format is
347 the input is copied to the output, expanding any
351 The parser is also run, and as usual, the
355 are displayed before copying the input to the output.
357 PDF-1.1 output may be generated by
360 .Sx PostScript Output
363 arguments and defaults.
364 .Ss PostScript Output
367 Level-2 pages may be generated by
369 Output pages default to letter sized and are rendered in the Times font
371 Margins are calculated as 1/9 the page length and width.
374 Special characters are rendered as in
379 arguments are accepted:
381 .It Cm paper Ns = Ns Ar name
391 You may also manually specify dimensions as
393 width by height in millimetres.
394 If an unknown value is encountered,
401 to force a UTF\-8 locale.
404 for details and options.
408 conforms to XHTML-1.0 strict.
412 for details; beyond generating XHTML tags instead of HTML tags, these
413 output modes are identical.
417 utility exits with one of the following values, controlled by the message
423 .Bl -tag -width Ds -compact
425 No warnings or errors occurred, or those that did were ignored because
426 they were lower than the requested
429 At least one warning occurred, but no error, and
433 At least one parsing error occurred, but no fatal error, and
439 A fatal parsing error occurred.
441 Invalid command line arguments were specified.
442 No input files have been read.
444 An operating system error occurred, for example memory exhaustion or an
445 error accessing input files.
448 to exit at once, possibly in the middle of parsing or formatting a file.
454 .Fl W Ns Cm warning .
456 To page manuals to the terminal:
458 .Dl $ mandoc \-Wall,stop mandoc.1 2\*(Gt&1 | less
459 .Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
461 To produce HTML manuals with
465 .Dl $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
467 To check over a large set of manuals:
469 .Dl $ mandoc \-Tlint `find /usr/src -name \e*\e.[1-9]`
471 To produce a series of PostScript manuals for A4 paper:
473 .Dl $ mandoc \-Tps \-Opaper=a4 mdoc.7 man.7 \*(Gt manuals.ps
479 format, for use on systems lacking an
483 .Dl $ mandoc \-Tman foo.mdoc \*(Gt foo.man
485 Standard error messages reporting parsing errors are prefixed by
488 .D1 Ar file : line : column : \ level :
491 where the fields have the following meanings:
492 .Bl -tag -width "column"
494 The name of the input file causing the message.
496 The line number in that input file.
497 Line numbering starts at 1.
499 The column number in that input file.
500 Column numbering starts at 1.
501 If the issue is caused by a word, the column number usually
502 points to the first character of the word.
504 The message level, printed in capital letters.
507 Message levels have the following meanings:
508 .Bl -tag -width "warning"
510 The parser is unable to parse a given input file at all.
511 No formatted output is produced from that input file.
513 An input file contains syntax that cannot be safely interpreted,
514 either because it is invalid or because
516 does not implement it yet.
517 By discarding part of the input or inserting missing tokens,
518 the parser is able to continue, and the error does not prevent
519 generation of formatted output, but typically, preparing that
520 output involves information loss, broken document structure
521 or unintended formatting.
523 An input file uses obsolete, discouraged or non-portable syntax.
524 All the same, the meaning of the input is unambiguous and a correct
525 rendering can be produced.
526 Documents causing warnings may render poorly when using other
527 formatting tools instead of
535 levels are hidden unless their level, or a lower level, is requested using a
543 utility may also print messages related to invalid command line arguments
544 or operating system errors, for example when memory is exhausted or
545 input files cannot be read.
546 Such messages do not carry the prefix described above.
548 This section summarises
550 compatibility with GNU troff.
551 Each input and output format is separately noted.
552 .Ss ASCII Compatibility
555 Unrenderable unicode codepoints specified with
557 escapes are printed as
560 In GNU troff, these raise an error.
570 are synonyms, as are \-filled and \-ragged.
572 In historic GNU troff, the
575 macro does not underline when scoped under an
577 in the FILES section.
578 This behaves correctly in
581 A list or display following the
586 does not assert a prior vertical break, just as it doesn't with
596 Words aren't hyphenated.
598 .Ss HTML/XHTML Compatibility
603 escape will revert the font to the previous
605 escape, not to the last rendered decoration, which is now dictated by
606 CSS instead of hard-coded.
607 It also will not span past the current scope,
611 mode, this will work fine.
618 list types render similarly (no break following overreached left-hand
619 side) due to the expressive constraints of HTML.
626 lists render similarly.
638 utility was written by
639 .An Kristaps Dzonsons ,
640 .Mt kristaps@bsd.lv .
646 the maximum size of an element attribute is determined by
648 which is usually 1024 bytes.
649 Be aware of this when setting long link
651 .Fl O Ns Cm style Ns = Ns Ar really/long/link .
653 Nesting elements within next-line element scopes of
663 and cause them to forget the formatting of the prior next-line scope.
667 control character is an alias for the standard macro control character
668 and does not emit a line-break as stipulated in GNU troff.