1 .\" $Id: mandoc.1,v 1.81 2010/12/16 23:07:01 kristaps Exp $
3 .\" Copyright (c) 2009, 2010 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: December 16 2010 $
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:
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 .
179 Produce PostScript output.
181 .Sx PostScript Output .
183 Produce an indented parse tree.
185 Produce strict CSS1/XHTML-1.0 output.
190 If multiple input files are specified, these will be processed by the
191 corresponding filter in-order.
195 which is the default, is rendered in standard 7-bit ASCII documented in
198 Font styles are applied by using back-spaced encoding such that an
202 .Sq _ Ns \e[bs] Ns c ,
205 is the back-space character number 8.
206 Emboldened characters are rendered as
207 .Sq c Ns \e[bs] Ns c .
209 The special characters documented in
211 are rendered best-effort in an ASCII equivalent.
213 Output width is limited to 78 visible columns unless literal input lines
218 arguments are accepted:
220 .It Cm width Ns = Ns Ar width
221 The output width is set to
223 which will normalise to \(>=60.
228 conforms to HTML-4.01 strict.
230 Font styles and page structure are applied using CSS1.
231 By default, no font style is applied to any text,
232 although CSS1 is hard-coded to format
233 the basic structure of output.
236 .Pa example.style.css
237 file documents the range of styles applied to output and, if used, will
238 cause rendered documents to appear as they do in
241 Special characters are rendered in decimal-encoded UTF-8.
245 arguments are accepted:
247 .It Cm includes Ns = Ns Ar fmt
252 is used as a template for linked header files (usually via the
257 are replaced with the include filename.
258 The default is not to present a
260 .It Cm man Ns = Ns Ar fmt
264 .Ar ../html%S/%N.%S.html ,
265 is used as a template for linked manuals (usually via the
272 are replaced with the linked manual's name and section, respectively.
273 If no section is included, section 1 is assumed.
274 The default is not to
276 .It Cm style Ns = Ns Ar style.css
279 is used for an external style-sheet.
280 This must be a valid absolute or
283 .Ss PostScript Output
286 Level-2 pages may be generated by
288 Output pages default to letter sized and are rendered in the Times font
290 Margins are calculated as 1/9 the page length and width.
293 Special characters are rendered as in
298 arguments are accepted:
300 .It Cm paper Ns = Ns Ar name
310 You may also manually specify dimensions as
312 width by height in millimetres.
313 If an unknown value is encountered,
318 PDF-1.1 output may be generated by
321 .Sx PostScript Output
324 arguments and defaults.
328 conforms to XHTML-1.0 strict.
332 for details; beyond generating XHTML tags instead of HTML tags, these
333 output modes are identical.
337 utility exits with one of the following values, controlled by the message
343 .Bl -tag -width Ds -compact
345 No warnings or errors occurred, or those that did were ignored because
346 they were lower than the requested
349 At least one warning occurred, but no error, and
353 At least one parsing error occurred, but no fatal error, and
359 A fatal parsing error occurred.
361 Invalid command line arguments were specified.
362 No input files have been read.
364 An operating system error occurred, for example memory exhaustion or an
365 error accessing input files.
368 to exit at once, possibly in the middle of parsing or formatting a file.
374 .Fl W Ns Cm warning .
376 To page manuals to the terminal:
378 .D1 $ mandoc \-Wall,stop mandoc.1 2\*(Gt&1 | less
379 .D1 $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
381 To produce HTML manuals with
385 .D1 $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
387 To check over a large set of manuals:
389 .Dl $ mandoc \-Tlint `find /usr/src -name \e*\e.[1-9]`
391 To produce a series of PostScript manuals for A4 paper:
393 .D1 $ mandoc \-Tps \-Opaper=a4 mdoc.7 man.7 \*(Gt manuals.ps
395 Standard error messages reporting parsing errors are prefixed by
398 .D1 Ar file : line : column : \ level :
401 where the fields have the following meanings:
402 .Bl -tag -width "column"
404 The name of the input file causing the message.
406 The line number in that input file.
407 Line numbering starts at 1.
409 The column number in that input file.
410 Column numbering starts at 1.
411 If the issue is caused by a word, the column number usually
412 points to the first character of the word.
414 The message level, printed in capital letters.
417 Message levels have the following meanings:
418 .Bl -tag -width "warning"
420 The parser is unable to parse a given input file at all.
421 No formatted output is produced from that input file.
423 An input file contains syntax that cannot be safely interpreted,
424 either because it is invalid or because
426 does not implement it yet.
427 By discarding part of the input or inserting missing tokens,
428 the parser is able to continue, and the error does not prevent
429 generation of formatted output, but typically, preparing that
430 output involves information loss, broken document structure
431 or unintended formatting.
433 An input file uses obsolete, discouraged or non-portable syntax.
434 All the same, the meaning of the input is unambiguous and a correct
435 rendering can be produced.
436 Documents causing warnings may render poorly when using other
437 formatting tools instead of
445 levels are hidden unless their level, or a lower level, is requested using a
453 utility may also print messages related to invalid command line arguments
454 or operating system errors, for example when memory is exhausted or
455 input files cannot be read.
456 Such messages do not carry the prefix described above.
458 This section summarises
460 compatibility with GNU troff.
461 Each input and output format is separately noted.
462 .Ss ASCII Compatibility
473 are synonyms, as are \-filled and \-ragged.
478 macro does not underline when scoped under an
480 in the FILES section.
481 This behaves correctly in
484 A list or display following the
489 does not assert a prior vertical break, just as it doesn't with
499 Words aren't hyphenated.
501 Sentences are unilaterally monospaced.
503 .Ss HTML/XHTML Compatibility
508 escape will revert the font to the previous
510 escape, not to the last rendered decoration, which is now dictated by
511 CSS instead of hard-coded.
512 It also will not span past the current scope,
516 mode, this will work fine.
523 list types render similarly (no break following overreached left-hand
524 side) due to the expressive constraints of HTML.
531 lists render similarly.
540 utility was written by
541 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
547 the maximum size of an element attribute is determined by
549 which is usually 1024 bytes.
550 Be aware of this when setting long link
552 .Fl O Ns Cm style Ns = Ns Ar really/long/link .
554 Nesting elements within next-line element scopes of
564 and cause them to forget the formatting of the prior next-line scope.
568 control character is an alias for the standard macro control character
569 and does not emit a line-break as stipulated in GNU troff.