Annotation of mandoc/mandoc.1, Revision 1.33
1.33 ! kristaps 1: .\" $Id: mandoc.1,v 1.32 2009/08/20 12:08:40 kristaps Exp $
1.1 kristaps 2: .\"
1.17 kristaps 3: .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
1.1 kristaps 4: .\"
5: .\" Permission to use, copy, modify, and distribute this software for any
1.16 kristaps 6: .\" purpose with or without fee is hereby granted, provided that the above
7: .\" copyright notice and this permission notice appear in all copies.
1.1 kristaps 8: .\"
1.16 kristaps 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.
1.1 kristaps 16: .\"
17: .Dd $Mdocdate$
1.14 kristaps 18: .Dt MANDOC 1
1.1 kristaps 19: .Os
1.32 kristaps 20: .
21: .
1.1 kristaps 22: .Sh NAME
23: .Nm mandoc
1.8 kristaps 24: .Nd format and display UNIX manuals
1.32 kristaps 25: .
26: .
1.1 kristaps 27: .Sh SYNOPSIS
28: .Nm mandoc
29: .Op Fl V
30: .Op Fl f Ns Ar option...
1.8 kristaps 31: .Op Fl m Ns Ar format
1.1 kristaps 32: .Op Fl W Ns Ar err...
33: .Op Fl T Ns Ar output
34: .Op Ar infile...
1.32 kristaps 35: .
36: .
1.1 kristaps 37: .Sh DESCRIPTION
38: The
39: .Nm
1.26 kristaps 40: utility formats
1.8 kristaps 41: .Ux
42: manual pages for display. The arguments are as follows:
1.32 kristaps 43: .
1.19 kristaps 44: .Bl -tag -width Ds
1.1 kristaps 45: .It Fl f Ns Ar option...
1.26 kristaps 46: Override default compiler behaviour. See
1.1 kristaps 47: .Sx Compiler Options
48: for details.
1.32 kristaps 49: .
1.19 kristaps 50: .It Fl m Ns Ar format
1.8 kristaps 51: Input format. See
52: .Sx Input Formats
53: for available formats. Defaults to
1.12 kristaps 54: .Fl m Ns Ar andoc .
1.32 kristaps 55: .
1.19 kristaps 56: .It Fl T Ns Ar output
1.1 kristaps 57: Output format. See
58: .Sx Output Formats
59: for available formats. Defaults to
60: .Fl T Ns Ar ascii .
1.32 kristaps 61: .
1.1 kristaps 62: .It Fl V
63: Print version and exit.
1.32 kristaps 64: .
1.1 kristaps 65: .It Fl W Ns Ar err...
1.24 kristaps 66: Configure warning messages. Use
1.1 kristaps 67: .Fl W Ns Ar all
1.24 kristaps 68: to print warnings,
1.26 kristaps 69: .Fl W Ns Ar error
1.24 kristaps 70: for warnings to be considered errors and cause utility
1.26 kristaps 71: termination. Multiple
1.1 kristaps 72: .Fl W
73: arguments may be comma-separated, such as
74: .Fl W Ns Ar error,all .
1.32 kristaps 75: .
1.1 kristaps 76: .It Ar infile...
77: Read input from zero or more
78: .Ar infile .
1.2 kristaps 79: If unspecified, reads from stdin. If multiple files are specified,
80: .Nm
81: will halt with the first failed parse.
1.1 kristaps 82: .El
1.32 kristaps 83: .
1.1 kristaps 84: .Pp
1.26 kristaps 85: By default,
86: .Nm
87: reads
1.8 kristaps 88: .Xr mdoc 7
1.12 kristaps 89: or
90: .Xr man 7
1.8 kristaps 91: text from stdin, implying
1.12 kristaps 92: .Fl m Ns Ar andoc ,
1.8 kristaps 93: and prints 78-column backspace-encoded output to stdout as if
1.1 kristaps 94: .Fl T Ns Ar ascii
95: were provided.
1.32 kristaps 96: .
1.1 kristaps 97: .Pp
98: .Ex -std mandoc
1.32 kristaps 99: .
100: .
1.22 kristaps 101: .Ss Punctuation and Spacing
1.13 kristaps 102: If punctuation is set apart from words, such as in the phrase
103: .Dq to be \&, or not to be ,
104: it's processed by
105: .Nm
1.22 kristaps 106: according to the following rules: opening punctuation
1.4 kristaps 107: .Po
1.26 kristaps 108: .Sq \&( ,
109: .Sq \&[ ,
1.4 kristaps 110: and
111: .Sq \&{
1.26 kristaps 112: .Pc
1.22 kristaps 113: is not followed by a space; closing punctuation
1.4 kristaps 114: .Po
1.26 kristaps 115: .Sq \&. ,
116: .Sq \&, ,
117: .Sq \&; ,
118: .Sq \&: ,
119: .Sq \&? ,
120: .Sq \&! ,
121: .Sq \&) ,
122: .Sq \&]
1.4 kristaps 123: and
124: .Sq \&}
1.26 kristaps 125: .Pc
1.15 kristaps 126: is not preceded by whitespace.
1.32 kristaps 127: .
1.4 kristaps 128: .Pp
1.13 kristaps 129: If the input is
130: .Xr mdoc 7 ,
131: these rules are also applied to macro arguments when appropriate.
1.32 kristaps 132: .
1.22 kristaps 133: .Pp
134: White-space, in non-literal (normal) mode, is stripped from input and
1.33 ! kristaps 135: replaced on output by a single space. Thus, if you wish to preserve multiple
! 136: spaces, they must be space-escaped or used in a literal display mode, e.g.,
1.27 kristaps 137: .Sq \&Bd \-literal
1.26 kristaps 138: in
1.22 kristaps 139: .Xr mdoc 7 .
1.32 kristaps 140: .
141: .
1.8 kristaps 142: .Ss Input Formats
143: The
144: .Nm
145: utility accepts
146: .Xr mdoc 7
147: and
148: .Xr man 7
149: input with
1.10 kristaps 150: .Fl m Ns Ar doc
1.8 kristaps 151: and
1.10 kristaps 152: .Fl m Ns Ar an ,
1.8 kristaps 153: respectively. The
154: .Xr mdoc 7
155: format is
156: .Em strongly
1.26 kristaps 157: recommended;
1.8 kristaps 158: .Xr man 7
159: should only be used for legacy manuals.
1.32 kristaps 160: .
1.11 kristaps 161: .Pp
1.12 kristaps 162: A third option,
163: .Fl m Ns Ar andoc ,
1.13 kristaps 164: which is also the default, determines encoding on-the-fly: if the first
1.26 kristaps 165: non-comment macro is
1.27 kristaps 166: .Sq \&Dd
1.13 kristaps 167: or
1.27 kristaps 168: .Sq \&Dt ,
1.26 kristaps 169: the
1.13 kristaps 170: .Xr mdoc 7
171: parser is used; otherwise, the
172: .Xr man 7
173: parser is used.
1.32 kristaps 174: .
1.13 kristaps 175: .Pp
176: If multiple
1.26 kristaps 177: files are specified with
178: .Fl m Ns Ar andoc ,
1.13 kristaps 179: each has its file-type determined this way. If multiple files are
180: specified and
1.12 kristaps 181: .Fl m Ns Ar doc
182: or
183: .Fl m Ns Ar an
184: is specified, then this format is used exclusively.
1.32 kristaps 185: .
186: .
1.1 kristaps 187: .Ss Output Formats
188: The
189: .Nm
190: utility accepts the following
191: .Fl T
192: arguments:
1.32 kristaps 193: .
1.19 kristaps 194: .Bl -tag -width Ds
1.13 kristaps 195: .It Fl T Ns Ar ascii
1.1 kristaps 196: Produce 7-bit ASCII output, backspace-encoded for bold and underline
197: styles. This is the default.
1.32 kristaps 198: .
1.13 kristaps 199: .It Fl T Ns Ar tree
1.1 kristaps 200: Produce an indented parse tree.
1.32 kristaps 201: .
1.13 kristaps 202: .It Fl T Ns Ar lint
1.1 kristaps 203: Parse only: produce no output.
204: .El
1.32 kristaps 205: .
1.13 kristaps 206: .Pp
207: If multiple input files are specified, these will be processed by the
208: corresponding filter in-order.
1.32 kristaps 209: .
210: .
1.1 kristaps 211: .Ss Compiler Options
212: Default compiler behaviour may be overriden with the
213: .Fl f
214: flag.
1.32 kristaps 215: .
1.19 kristaps 216: .Bl -tag -width Ds
1.1 kristaps 217: .It Fl f Ns Ar ign-scope
218: When rewinding the scope of a block macro, forces the compiler to ignore
219: scope violations. This can seriously mangle the resulting tree.
1.8 kristaps 220: .Pq mdoc only
1.32 kristaps 221: .
1.21 kristaps 222: .It Fl f Ns Ar no-ign-escape
223: Don't ignore invalid escape sequences.
1.32 kristaps 224: .
1.12 kristaps 225: .It Fl f Ns Ar no-ign-macro
1.21 kristaps 226: Do not ignore unknown macros at the start of input lines.
1.32 kristaps 227: .
1.21 kristaps 228: .It Fl f Ns Ar no-ign-chars
229: Do not ignore disallowed characters.
1.32 kristaps 230: .
1.21 kristaps 231: .It Fl f Ns Ar strict
1.26 kristaps 232: Implies
1.21 kristaps 233: .Fl f Ns Ar no-ign-escape ,
1.26 kristaps 234: .Fl f Ns Ar no-ign-macro
1.21 kristaps 235: and
1.26 kristaps 236: .Fl f Ns Ar no-ign-chars .
1.32 kristaps 237: .
1.28 kristaps 238: .It Fl f Ns Ar ign-errors
239: Don't halt when encountering parse errors. Useful with
240: .Fl T Ns Ar lint
241: over a large set of manuals passed on the command line.
1.1 kristaps 242: .El
1.32 kristaps 243: .
1.1 kristaps 244: .Pp
245: As with the
246: .Fl W
247: flag, multiple
248: .Fl f
249: options may be grouped and delimited with a comma. Using
1.21 kristaps 250: .Fl f Ns Ar ign-scope,no-ign-escape ,
251: for example, will try to ignore scope and not ignore character-escape
252: errors.
1.32 kristaps 253: .
254: .
1.1 kristaps 255: .Sh EXAMPLES
1.13 kristaps 256: To page manuals to the terminal:
1.32 kristaps 257: .
1.1 kristaps 258: .Pp
1.21 kristaps 259: .D1 % mandoc \-Wall,error \-fstrict mandoc.1 2>&1 | less
1.13 kristaps 260: .D1 % mandoc mandoc.1 mdoc.3 mdoc.7 | less
1.32 kristaps 261: .
1.28 kristaps 262: .Pp
263: To check over a large set of manuals:
1.32 kristaps 264: .
1.28 kristaps 265: .Pp
266: .Dl % mandoc \-Tlint \-fign-errors `find /usr/src -name \e*\e.[1-9]`
1.32 kristaps 267: .
268: .
1.20 kristaps 269: .Sh COMPATIBILITY
1.26 kristaps 270: This section summarises
1.20 kristaps 271: .Nm
1.26 kristaps 272: compatibility with
1.20 kristaps 273: .Xr groff 1 .
1.32 kristaps 274: Each input and output format is separately noted.
275: .
276: .
277: .Ss ASCII output
1.20 kristaps 278: .Bl -bullet -compact
1.29 kristaps 279: .It
280: The
281: .Sq \e~
1.32 kristaps 282: special character doesn't produce expected behaviour in
283: .Fl T Ns Ar ascii .
284: .
285: .It
286: The
1.33 ! kristaps 287: .Sq \&Bd \-literal
1.32 kristaps 288: and
289: .Sq \&Bd \-unfilled
290: macros of
291: .Xr mdoc 7
292: in
293: .Fl T Ns Ar ascii
294: are synonyms, as are \-filled and \-ragged.
295: .
1.26 kristaps 296: .It
1.27 kristaps 297: In
298: .Xr groff 1 ,
299: the
300: .Sq \&Pa
1.32 kristaps 301: .Xr mdoc 7
302: macro does not underline when scoped under an
1.30 kristaps 303: .Sq \&It
304: in the FILES section. This behaves correctly in
1.27 kristaps 305: .Nm .
1.32 kristaps 306: .
1.27 kristaps 307: .It
1.20 kristaps 308: A list or display following
1.27 kristaps 309: .Sq \&Ss
1.32 kristaps 310: .Xr mdoc 7
311: macro in
312: .Fl T Ns Ar ascii
1.20 kristaps 313: does not assert a prior vertical break, just as it doesn't with
1.27 kristaps 314: .Sq \&Sh .
1.32 kristaps 315: .
1.20 kristaps 316: .It
1.32 kristaps 317: The
318: .Sq \&na
319: and
320: .Sq \&Dt
321: .Xr man 7
322: macros in
323: .Fl T Ns Ar ascii
324: have no effect.
325: .
1.20 kristaps 326: .It
327: Words aren't hyphenated.
1.32 kristaps 328: .
1.22 kristaps 329: .It
330: In normal mode (not a literal block), blocks of spaces aren't preserved,
1.32 kristaps 331: so double spaces following sentence closure are reduced to a single space;
332: .Xr groff 1
333: retains spaces.
334: .
335: .It
336: Sentences are unilaterally monospaced.
1.20 kristaps 337: .El
338: .\" SECTION
1.1 kristaps 339: .Sh SEE ALSO
1.13 kristaps 340: .Xr mandoc_char 7 ,
1.9 kristaps 341: .Xr mdoc 7 ,
342: .Xr man 7
1.20 kristaps 343: .\" SECTION
1.1 kristaps 344: .Sh AUTHORS
345: The
346: .Nm
1.26 kristaps 347: utility was written by
1.18 kristaps 348: .An Kristaps Dzonsons Aq kristaps@kth.se .
CVSweb