1 .\" $Id: mandoc.1,v 1.64 2010/06/25 19:02:48 kristaps Exp $
3 .\" Copyright (c) 2009 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: June 25 2010 $
22 .Nd format and display UNIX manuals
37 manual pages for display.
38 The arguments are as follows:
41 Comma-separated compiler options.
49 for available formats.
53 Comma-separated output options.
61 for available formats.
65 Print version and exit.
67 Comma-separated warning options.
72 for warnings to be considered errors and cause utility
76 arguments may be comma-separated, such as
77 .Fl W Ns Cm error , Ns Cm all .
79 Read input from zero or more files.
80 If unspecified, reads from stdin.
81 If multiple files are specified,
83 will halt with the first failed parse.
92 text from stdin, implying
117 should only be used for legacy manuals.
121 which is also the default, determines encoding on-the-fly: if the first
128 parser is used; otherwise, the
133 files are specified with
135 each has its file-type determined this way.
136 If multiple files are
141 is specified, then this format is used exclusively.
145 utility accepts the following
151 Produce 7-bit ASCII output, backspace-encoded for bold and underline
157 Produce strict HTML-4.01 output, with a sane default style.
161 Parse only: produce no output.
167 Produce PostScript output.
169 .Sx PostScript Output .
171 Produce an indented parse tree.
173 Produce strict XHTML-1.0 output, with a sane default style.
178 If multiple input files are specified, these will be processed by the
179 corresponding filter in-order.
181 Default compiler behaviour may be overridden with the
185 .It Fl f Ns Cm ign-errors
186 When parsing multiple files, don't halt when one errors out.
189 over a large set of manuals passed on the command line.
190 .It Fl f Ns Cm ign-escape
191 Ignore invalid escape sequences.
192 This is the default, but the option can be used to override an earlier
194 .It Fl f Ns Cm ign-scope
195 When rewinding the scope of a block macro, forces the compiler to ignore
197 This can seriously mangle the resulting tree.
199 .It Fl f Ns Cm no-ign-escape
200 Do not ignore invalid escape sequences.
201 .It Fl f Ns Cm no-ign-macro
202 Do not ignore unknown macros at the start of input lines.
203 .It Fl f Ns Cm strict
205 .Fl f Ns Cm no-ign-escape
207 .Fl f Ns Cm no-ign-macro .
214 modes accept the following
218 .It Cm includes Ns = Ns Ar fmt
223 is used as a template for linked header files (usually via the
228 are replaced with the include filename.
229 The default is not to present a
231 .It Cm man Ns = Ns Ar fmt
235 .Ar ../html%S/%N.%S.html ,
236 is used as a template for linked manuals (usually via the
243 are replaced with the linked manual's name and section, respectively.
244 If no section is included, section 1 is assumed.
245 The default is not to
247 .It Cm style Ns = Ns Ar style.css
250 is used for an external style-sheet.
251 This must be a valid absolute or
257 mode accepts the following
261 .It Cm width Ns = Ns Ar width
262 The output width is set to
264 which will normalise to \(>=60.
267 This section documents output details of
269 In general, output conforms to the traditional manual style of a header,
270 a body composed of sections and sub-sections, and a footer.
272 The text style of output characters (non-macro characters, punctuation,
273 and white-space) is dictated by context.
275 White-space is generally stripped from input.
276 This can be changed with
277 character escapes (specified in
279 or literal modes (specified in
284 If non-macro punctuation is set apart from words, such as in the phrase
285 .Dq to be \&, or not to be ,
288 regardless of output format, according to the following rules: opening
296 is not followed by a space; closing punctuation
309 is not preceded by white-space.
313 however, these rules are also applied to macro arguments when appropriate.
317 which is the default, is rendered in standard 7-bit ASCII documented in
320 Font styles are applied by using back-spaced encoding such that an
324 .Sq _ Ns \e[bs] Ns c ,
327 is the back-space character number 8.
328 Emboldened characters are rendered as
329 .Sq c Ns \e[bs] Ns c .
331 The special characters documented in
333 are rendered best-effort in an ASCII equivalent.
335 Output width is limited to 78 visible columns unless literal input lines
340 conforms to HTML-4.01 strict.
342 Font styles and page structure are applied using CSS2.
343 By default, no font style is applied to any text,
344 although CSS2 is hard-coded to format
345 the basic structure of output.
348 .Pa example.style.css
349 file documents the range of styles applied to output and, if used, will
350 cause rendered documents to appear as they do in
353 Special characters are rendered in decimal-encoded UTF-8.
354 .Ss PostScript Output
355 PostScript Level 2 pages may be generated by
357 Output pages are US-letter sized (215.9 x 279.4 mm) and rendered in
358 fixed, 10-point Courier font.
362 conforms to XHTML-1.0 strict.
366 for details; beyond generating XHTML tags instead of HTML tags, these
367 output modes are identical.
369 To page manuals to the terminal:
371 .D1 $ mandoc \-Wall,error \-fstrict mandoc.1 2\*(Gt&1 | less
372 .D1 $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
374 To produce HTML manuals with
378 .D1 $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
380 To check over a large set of manuals:
382 .Dl $ mandoc \-Tlint \-fign-errors `find /usr/src -name \e*\e.[1-9]`
384 This section summarises
388 Each input and output format is separately noted.
389 .Ss ASCII Compatibility
394 special character doesn't produce expected behaviour in
405 are synonyms, as are \-filled and \-ragged.
412 macro does not underline when scoped under an
414 in the FILES section.
415 This behaves correctly in
418 A list or display following the
423 does not assert a prior vertical break, just as it doesn't with
433 Words aren't hyphenated.
435 In normal mode (not a literal block), blocks of spaces aren't preserved,
436 so double spaces following sentence closure are reduced to a single space;
440 Sentences are unilaterally monospaced.
442 .Ss HTML/XHTML Compatibility
447 escape will revert the font to the previous
449 escape, not to the last rendered decoration, which is now dictated by
450 CSS instead of hard-coded.
451 It also will not span past the current scope,
455 mode, this will work fine.
462 list types render similarly (no break following overreached left-hand
463 side) due to the expressive constraints of HTML.
470 lists render similarly.
479 utility was written by
480 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
486 CSS2 styling used for
488 input lists does not render properly in older browsers, such as Internet
489 Explorer 6 and earlier.
495 the maximum size of an element attribute is determined by
497 which is usually 1024 bytes.
498 Be aware of this when setting long link
500 .Fl O Ns Cm style Ns = Ns Ar really/long/link .
506 output modes don't render the
508 font size escape documented in
513 Nesting elements within next-line element scopes of
523 and cause them to forget the formatting of the prior next-line scope.
529 should italicise all subsequent text if a line argument is not provided.
530 This behaviour is not implemented.
533 control character is an alias for the standard macro control character
534 and does not emit a line-break as stipulated in GNU troff.