Annotation of mandoc/mandoc.1, Revision 1.175
1.175 ! schwarze 1: .\" $Id: mandoc.1,v 1.174 2017/02/10 15:45:28 schwarze Exp $
1.1 kristaps 2: .\"
1.92 schwarze 3: .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.168 schwarze 4: .\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
1.1 kristaps 5: .\"
6: .\" Permission to use, copy, modify, and distribute this software for any
1.16 kristaps 7: .\" purpose with or without fee is hereby granted, provided that the above
8: .\" copyright notice and this permission notice appear in all copies.
1.1 kristaps 9: .\"
1.16 kristaps 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.
1.1 kristaps 17: .\"
1.175 ! schwarze 18: .Dd $Mdocdate: February 10 2017 $
1.14 kristaps 19: .Dt MANDOC 1
1.1 kristaps 20: .Os
21: .Sh NAME
22: .Nm mandoc
1.8 kristaps 23: .Nd format and display UNIX manuals
1.1 kristaps 24: .Sh SYNOPSIS
25: .Nm mandoc
1.153 schwarze 26: .Op Fl acfhkl
1.156 schwarze 27: .Op Fl I Cm os Ns = Ns Ar name
28: .Op Fl K Ar encoding
1.8 kristaps 29: .Op Fl m Ns Ar format
1.156 schwarze 30: .Op Fl O Ar option
31: .Op Fl T Ar output
32: .Op Fl W Ar level
1.89 kristaps 33: .Op Ar
1.1 kristaps 34: .Sh DESCRIPTION
35: The
36: .Nm
1.26 kristaps 37: utility formats
1.8 kristaps 38: .Ux
1.57 kristaps 39: manual pages for display.
1.100 kristaps 40: .Pp
41: By default,
42: .Nm
43: reads
44: .Xr mdoc 7
45: or
46: .Xr man 7
47: text from stdin, implying
48: .Fl m Ns Cm andoc ,
49: and produces
1.156 schwarze 50: .Fl T Cm locale
1.100 kristaps 51: output.
52: .Pp
1.109 schwarze 53: The options are as follows:
1.19 kristaps 54: .Bl -tag -width Ds
1.107 schwarze 55: .It Fl a
56: If the standard output is a terminal device and
57: .Fl c
58: is not specified, use
59: .Xr more 1
60: to paginate the output, just like
61: .Xr man 1
62: would.
63: .It Fl c
64: Copy the formatted manual pages to the standard output without using
65: .Xr more 1
66: to paginate them.
67: This is the default.
68: It can be specified to override
69: .Fl a .
1.109 schwarze 70: .It Fl f
71: A synonym for
72: .Xr whatis 1 .
73: This overrides any earlier
74: .Fl k
75: and
76: .Fl l
77: options.
1.167 schwarze 78: .It Fl h
79: Display only the SYNOPSIS lines.
80: Implies
81: .Fl c .
1.156 schwarze 82: .It Fl I Cm os Ns = Ns Ar name
1.101 schwarze 83: Override the default operating system
84: .Ar name
85: for the
86: .Xr mdoc 7
87: .Sq \&Os
1.130 schwarze 88: and for the
89: .Xr man 7
90: .Sq \&TH
1.101 schwarze 91: macro.
1.156 schwarze 92: .It Fl K Ar encoding
1.119 schwarze 93: Specify the input encoding.
94: The supported
95: .Ar encoding
96: arguments are
97: .Cm us-ascii ,
98: .Cm iso-8859-1 ,
99: and
100: .Cm utf-8 .
101: If not specified, autodetection uses the first match:
102: .Bl -tag -width iso-8859-1
103: .It Cm utf-8
104: if the first three bytes of the input file
105: are the UTF-8 byte order mark (BOM, 0xefbbbf)
106: .It Ar encoding
107: if the first or second line of the input file matches the
108: .Sy emacs
109: mode line format
110: .Pp
111: .D1 .\e" -*- Oo ...; Oc coding: Ar encoding ; No -*-
112: .It Cm utf-8
113: if the first non-ASCII byte in the file introduces a valid UTF-8 sequence
114: .It Cm iso-8859-1
115: otherwise
116: .El
1.109 schwarze 117: .It Fl k
118: A synonym for
119: .Xr apropos 1 .
120: This overrides any earlier
121: .Fl f
122: and
123: .Fl l
124: options.
125: .It Fl l
126: A synonym for
127: .Fl a .
128: Also reverts any earlier
129: .Fl f
130: and
131: .Fl k
132: options.
1.19 kristaps 133: .It Fl m Ns Ar format
1.57 kristaps 134: Input format.
135: See
1.8 kristaps 136: .Sx Input Formats
1.57 kristaps 137: for available formats.
138: Defaults to
1.58 kristaps 139: .Fl m Ns Cm andoc .
1.156 schwarze 140: .It Fl O Ar option
1.57 kristaps 141: Comma-separated output options.
1.156 schwarze 142: .It Fl T Ar output
1.57 kristaps 143: Output format.
144: See
1.1 kristaps 145: .Sx Output Formats
1.57 kristaps 146: for available formats.
147: Defaults to
1.156 schwarze 148: .Fl T Cm locale .
149: .It Fl W Ar level
1.77 schwarze 150: Specify the minimum message
151: .Ar level
152: to be reported on the standard error output and to affect the exit status.
153: The
154: .Ar level
155: can be
1.133 schwarze 156: .Cm warning ,
157: .Cm error ,
1.77 schwarze 158: or
1.133 schwarze 159: .Cm unsupp ;
1.132 schwarze 160: .Cm all
1.77 schwarze 161: is an alias for
1.132 schwarze 162: .Cm warning .
163: By default,
164: .Nm
165: is silent.
1.77 schwarze 166: See
167: .Sx EXIT STATUS
168: and
169: .Sx DIAGNOSTICS
170: for details.
171: .Pp
172: The special option
1.156 schwarze 173: .Fl W Cm stop
1.77 schwarze 174: tells
175: .Nm
176: to exit after parsing a file that causes warnings or errors of at least
177: the requested level.
178: No formatted output will be produced from that file.
179: If both a
180: .Ar level
181: and
182: .Cm stop
183: are requested, they can be joined with a comma, for example
1.156 schwarze 184: .Fl W Cm error , Ns Cm stop .
1.58 kristaps 185: .It Ar file
186: Read input from zero or more files.
1.57 kristaps 187: If unspecified, reads from stdin.
188: If multiple files are specified,
1.2 kristaps 189: .Nm
190: will halt with the first failed parse.
1.1 kristaps 191: .El
1.109 schwarze 192: .Pp
193: In
194: .Fl f
195: and
196: .Fl k
197: mode,
198: .Nm
199: also supports the options
200: .Fl CMmOSsw
201: described in the
202: .Xr apropos 1
203: manual.
1.8 kristaps 204: .Ss Input Formats
205: The
206: .Nm
207: utility accepts
208: .Xr mdoc 7
209: and
210: .Xr man 7
211: input with
1.58 kristaps 212: .Fl m Ns Cm doc
1.8 kristaps 213: and
1.58 kristaps 214: .Fl m Ns Cm an ,
1.57 kristaps 215: respectively.
216: The
1.8 kristaps 217: .Xr mdoc 7
218: format is
219: .Em strongly
1.26 kristaps 220: recommended;
1.8 kristaps 221: .Xr man 7
222: should only be used for legacy manuals.
1.11 kristaps 223: .Pp
1.12 kristaps 224: A third option,
1.58 kristaps 225: .Fl m Ns Cm andoc ,
1.13 kristaps 226: which is also the default, determines encoding on-the-fly: if the first
1.26 kristaps 227: non-comment macro is
1.27 kristaps 228: .Sq \&Dd
1.13 kristaps 229: or
1.27 kristaps 230: .Sq \&Dt ,
1.26 kristaps 231: the
1.13 kristaps 232: .Xr mdoc 7
233: parser is used; otherwise, the
234: .Xr man 7
235: parser is used.
236: .Pp
237: If multiple
1.26 kristaps 238: files are specified with
1.58 kristaps 239: .Fl m Ns Cm andoc ,
1.57 kristaps 240: each has its file-type determined this way.
241: If multiple files are
1.13 kristaps 242: specified and
1.58 kristaps 243: .Fl m Ns Cm doc
1.12 kristaps 244: or
1.58 kristaps 245: .Fl m Ns Cm an
1.12 kristaps 246: is specified, then this format is used exclusively.
1.1 kristaps 247: .Ss Output Formats
248: The
249: .Nm
250: utility accepts the following
251: .Fl T
1.66 kristaps 252: arguments, which correspond to output modes:
1.175 ! schwarze 253: .Bl -tag -width "-T markdown"
1.156 schwarze 254: .It Fl T Cm ascii
1.81 kristaps 255: Produce 7-bit ASCII output.
1.57 kristaps 256: See
1.48 kristaps 257: .Sx ASCII Output .
1.156 schwarze 258: .It Fl T Cm html
1.116 kristaps 259: Produce HTML5, CSS1, and MathML output.
1.57 kristaps 260: See
1.48 kristaps 261: .Sx HTML Output .
1.156 schwarze 262: .It Fl T Cm lint
1.58 kristaps 263: Parse only: produce no output.
264: Implies
1.156 schwarze 265: .Fl W Cm warning .
266: .It Fl T Cm locale
1.93 schwarze 267: Encode output using the current locale.
1.128 schwarze 268: This is the default.
1.93 schwarze 269: See
270: .Sx Locale Output .
1.156 schwarze 271: .It Fl T Cm man
1.95 kristaps 272: Produce
1.91 schwarze 273: .Xr man 7
1.95 kristaps 274: format output.
275: See
276: .Sx Man Output .
1.175 ! schwarze 277: .It Fl T Cm markdown
! 278: Produce output in
! 279: .Sy markdown
! 280: format.
! 281: See
! 282: .Sx Markdown Output .
1.156 schwarze 283: .It Fl T Cm pdf
1.73 kristaps 284: Produce PDF output.
285: See
286: .Sx PDF Output .
1.156 schwarze 287: .It Fl T Cm ps
1.62 kristaps 288: Produce PostScript output.
289: See
290: .Sx PostScript Output .
1.156 schwarze 291: .It Fl T Cm tree
1.58 kristaps 292: Produce an indented parse tree.
1.161 schwarze 293: See
294: .Sx Syntax tree output .
1.156 schwarze 295: .It Fl T Cm utf8
1.93 schwarze 296: Encode output in the UTF\-8 multi-byte format.
297: See
298: .Sx UTF\-8 Output .
1.156 schwarze 299: .It Fl T Cm xhtml
1.114 kristaps 300: This is a synonym for
1.156 schwarze 301: .Fl T Cm html .
1.1 kristaps 302: .El
1.13 kristaps 303: .Pp
304: If multiple input files are specified, these will be processed by the
305: corresponding filter in-order.
1.66 kristaps 306: .Ss ASCII Output
307: Output produced by
1.156 schwarze 308: .Fl T Cm ascii
1.128 schwarze 309: is rendered in standard 7-bit ASCII documented in
1.66 kristaps 310: .Xr ascii 7 .
311: .Pp
312: Font styles are applied by using back-spaced encoding such that an
313: underlined character
314: .Sq c
315: is rendered as
316: .Sq _ Ns \e[bs] Ns c ,
317: where
318: .Sq \e[bs]
319: is the back-space character number 8.
320: Emboldened characters are rendered as
321: .Sq c Ns \e[bs] Ns c .
322: .Pp
323: The special characters documented in
324: .Xr mandoc_char 7
325: are rendered best-effort in an ASCII equivalent.
326: .Pp
327: Output width is limited to 78 visible columns unless literal input lines
328: exceed this limit.
329: .Pp
330: The following
331: .Fl O
332: arguments are accepted:
1.19 kristaps 333: .Bl -tag -width Ds
1.98 schwarze 334: .It Cm indent Ns = Ns Ar indent
335: The left margin for normal text is set to
336: .Ar indent
337: blank characters instead of the default of five for
338: .Xr mdoc 7
339: and seven for
340: .Xr man 7 .
341: Increasing this is not recommended; it may result in degraded formatting,
1.99 schwarze 342: for example overfull lines or ugly line breaks.
1.66 kristaps 343: .It Cm width Ns = Ns Ar width
344: The output width is set to
345: .Ar width ,
1.141 schwarze 346: which will normalise to \(>=58.
1.1 kristaps 347: .El
1.66 kristaps 348: .Ss HTML Output
349: Output produced by
1.156 schwarze 350: .Fl T Cm html
1.114 kristaps 351: conforms to HTML5 using optional self-closing tags.
1.116 kristaps 352: Default styles use only CSS1.
353: Equations rendered from
354: .Xr eqn 7
355: blocks use MathML.
1.66 kristaps 356: .Pp
1.61 kristaps 357: The
1.164 schwarze 358: .Pa mandoc.css
1.83 kristaps 359: file documents style-sheet classes available for customising output.
360: If a style-sheet is not specified with
1.156 schwarze 361: .Fl O Cm style ,
362: .Fl T Cm html
1.114 kristaps 363: defaults to simple output (via an embedded style-sheet)
364: readable in any graphical or text-based web
1.83 kristaps 365: browser.
1.66 kristaps 366: .Pp
1.89 kristaps 367: Special characters are rendered in decimal-encoded UTF\-8.
1.66 kristaps 368: .Pp
369: The following
1.64 kristaps 370: .Fl O
1.66 kristaps 371: arguments are accepted:
1.37 kristaps 372: .Bl -tag -width Ds
1.94 kristaps 373: .It Cm fragment
1.123 schwarze 374: Omit the <!DOCTYPE> declaration and the <html>, <head>, and <body>
375: elements and only emit the subtree below the <body> element.
1.94 kristaps 376: The
377: .Cm style
1.97 schwarze 378: argument will be ignored.
1.94 kristaps 379: This is useful when embedding manual content within existing documents.
1.64 kristaps 380: .It Cm includes Ns = Ns Ar fmt
1.40 kristaps 381: The string
382: .Ar fmt ,
1.49 kristaps 383: for example,
1.40 kristaps 384: .Ar ../src/%I.html ,
385: is used as a template for linked header files (usually via the
386: .Sq \&In
1.57 kristaps 387: macro).
388: Instances of
1.43 kristaps 389: .Sq \&%I
1.57 kristaps 390: are replaced with the include filename.
391: The default is not to present a
1.40 kristaps 392: hyperlink.
1.64 kristaps 393: .It Cm man Ns = Ns Ar fmt
1.39 kristaps 394: The string
395: .Ar fmt ,
1.49 kristaps 396: for example,
1.39 kristaps 397: .Ar ../html%S/%N.%S.html ,
398: is used as a template for linked manuals (usually via the
1.37 kristaps 399: .Sq \&Xr
1.57 kristaps 400: macro).
401: Instances of
1.43 kristaps 402: .Sq \&%N
1.40 kristaps 403: and
404: .Sq %S
405: are replaced with the linked manual's name and section, respectively.
1.57 kristaps 406: If no section is included, section 1 is assumed.
407: The default is not to
1.40 kristaps 408: present a hyperlink.
1.64 kristaps 409: .It Cm style Ns = Ns Ar style.css
1.58 kristaps 410: The file
411: .Ar style.css
412: is used for an external style-sheet.
413: This must be a valid absolute or
414: relative URI.
1.61 kristaps 415: .El
1.93 schwarze 416: .Ss Locale Output
417: Locale-depending output encoding is triggered with
1.156 schwarze 418: .Fl T Cm locale .
1.128 schwarze 419: This is the default.
420: .Pp
1.93 schwarze 421: This option is not available on all systems: systems without locale
422: support, or those whose internal representation is not natively UCS-4,
423: will fall back to
1.156 schwarze 424: .Fl T Cm ascii .
1.93 schwarze 425: See
426: .Sx ASCII Output
427: for font style specification and available command-line arguments.
1.95 kristaps 428: .Ss Man Output
429: Translate input format into
430: .Xr man 7
431: output format.
1.102 schwarze 432: This is useful for distributing manual sources to legacy systems
1.96 kristaps 433: lacking
1.95 kristaps 434: .Xr mdoc 7
435: formatters.
436: .Pp
437: If
438: .Xr mdoc 7
439: is passed as input, it is translated into
1.97 schwarze 440: .Xr man 7 .
441: If the input format is
1.95 kristaps 442: .Xr man 7 ,
1.97 schwarze 443: the input is copied to the output, expanding any
1.95 kristaps 444: .Xr roff 7
445: .Sq so
1.97 schwarze 446: requests.
447: The parser is also run, and as usual, the
448: .Fl W
449: level controls which
450: .Sx DIAGNOSTICS
451: are displayed before copying the input to the output.
1.175 ! schwarze 452: .Ss Markdown Output
! 453: Translate
! 454: .Xr mdoc 7
! 455: input to the
! 456: .Sy markdown
! 457: format conforming to
! 458: .Lk http://daringfireball.net/projects/markdown/syntax.text\
! 459: "John Gruber's 2004 specification" .
! 460: .Pp
! 461: Markdown is a very weak markup language, so all semantic markup is
! 462: lost, and even part of the presentational markup may be lost.
! 463: Do not use this as an intermediate step in converting to HTML;
! 464: instead, use
! 465: .Fl T Cm html
! 466: directly.
! 467: .Pp
! 468: The
! 469: .Xr man 7 ,
! 470: .Xr tbl 7 ,
! 471: and
! 472: .Xr eqn 7
! 473: input languages are not supported by
! 474: .Fl T Cm markdown
! 475: output mode.
1.93 schwarze 476: .Ss PDF Output
477: PDF-1.1 output may be generated by
1.156 schwarze 478: .Fl T Cm pdf .
1.93 schwarze 479: See
480: .Sx PostScript Output
481: for
482: .Fl O
483: arguments and defaults.
1.62 kristaps 484: .Ss PostScript Output
1.65 kristaps 485: PostScript
486: .Qq Adobe-3.0
487: Level-2 pages may be generated by
1.156 schwarze 488: .Fl T Cm ps .
1.67 kristaps 489: Output pages default to letter sized and are rendered in the Times font
1.70 kristaps 490: family, 11-point.
491: Margins are calculated as 1/9 the page length and width.
1.71 kristaps 492: Line-height is 1.4m.
1.66 kristaps 493: .Pp
494: Special characters are rendered as in
495: .Sx ASCII Output .
496: .Pp
497: The following
498: .Fl O
499: arguments are accepted:
500: .Bl -tag -width Ds
501: .It Cm paper Ns = Ns Ar name
502: The paper size
503: .Ar name
504: may be one of
1.68 kristaps 505: .Ar a3 ,
506: .Ar a4 ,
507: .Ar a5 ,
508: .Ar legal ,
1.66 kristaps 509: or
510: .Ar letter .
1.68 kristaps 511: You may also manually specify dimensions as
512: .Ar NNxNN ,
513: width by height in millimetres.
514: If an unknown value is encountered,
515: .Ar letter
516: is used.
1.66 kristaps 517: .El
1.93 schwarze 518: .Ss UTF\-8 Output
519: Use
1.156 schwarze 520: .Fl T Cm utf8
1.93 schwarze 521: to force a UTF\-8 locale.
1.73 kristaps 522: See
1.93 schwarze 523: .Sx Locale Output
524: for details and options.
1.161 schwarze 525: .Ss Syntax tree output
526: Use
527: .Fl T Cm tree
528: to show a human readable representation of the syntax tree.
529: It is useful for debugging the source code of manual pages.
1.162 schwarze 530: The exact format is subject to change, so don't write parsers for it.
1.170 schwarze 531: .Pp
532: The first paragraph shows meta data found in the
533: .Xr mdoc 7
534: prologue, on the
535: .Xr man 7
536: .Ic \&TH
537: line, or the fallbacks used.
538: .Pp
539: In the tree dump, each output line shows one syntax tree node.
1.161 schwarze 540: Child nodes are indented with respect to their parent node.
541: The columns are:
542: .Pp
543: .Bl -enum -compact
544: .It
545: For macro nodes, the macro name; for text and
546: .Xr tbl 7
1.162 schwarze 547: nodes, the content.
548: There is a special format for
1.161 schwarze 549: .Xr eqn 7
550: nodes.
551: .It
552: Node type (text, elem, block, head, body, body-end, tail, tbl, eqn).
553: .It
554: Flags:
555: .Bl -dash -compact
556: .It
557: An opening parenthesis if the node is an opening delimiter.
558: .It
559: An asterisk if the node starts a new input line.
560: .It
561: The input line number (starting at one).
562: .It
563: A colon.
564: .It
565: The input column number (starting at one).
566: .It
567: A closing parenthesis if the node is a closing delimiter.
568: .It
569: A full stop if the node ends a sentence.
1.169 schwarze 570: .It
1.174 schwarze 571: BROKEN if the node is a block broken by another block.
572: .It
1.169 schwarze 573: NOSRC if the node is not in the input file,
574: but automatically generated from macros.
575: .It
576: NOPRT if the node is not supposed to generate output
577: for any output format.
1.161 schwarze 578: .El
1.174 schwarze 579: .El
580: .Pp
581: The following
582: .Fl O
583: argument is accepted:
584: .Bl -tag -width Ds
585: .It Cm noval
586: Skip validation and show the unvalidated syntax tree.
587: This can help to find out whether a given behaviour is caused by
588: the parser or by the validator.
589: Meta data is not available in this case.
1.161 schwarze 590: .El
1.108 schwarze 591: .Sh ENVIRONMENT
592: .Bl -tag -width MANPAGER
593: .It Ev MANPAGER
594: Any non-empty value of the environment variable
595: .Ev MANPAGER
596: will be used instead of the standard pagination program,
597: .Xr more 1 .
598: .It Ev PAGER
599: Specifies the pagination program to use when
600: .Ev MANPAGER
601: is not defined.
602: If neither PAGER nor MANPAGER is defined,
1.159 schwarze 603: .Xr more 1
604: .Fl s
1.108 schwarze 605: will be used.
606: .El
1.77 schwarze 607: .Sh EXIT STATUS
608: The
609: .Nm
610: utility exits with one of the following values, controlled by the message
611: .Ar level
612: associated with the
613: .Fl W
614: option:
615: .Pp
616: .Bl -tag -width Ds -compact
617: .It 0
618: No warnings or errors occurred, or those that did were ignored because
619: they were lower than the requested
620: .Ar level .
621: .It 2
622: At least one warning occurred, but no error, and
1.156 schwarze 623: .Fl W Cm warning
1.77 schwarze 624: was specified.
625: .It 3
1.133 schwarze 626: At least one parsing error occurred,
627: but no unsupported feature was encountered, and
1.156 schwarze 628: .Fl W Cm error
1.133 schwarze 629: or
1.156 schwarze 630: .Fl W Cm warning
1.133 schwarze 631: was specified.
632: .It 4
1.134 schwarze 633: At least one unsupported feature was encountered, and
1.156 schwarze 634: .Fl W Cm unsupp ,
635: .Fl W Cm error
1.77 schwarze 636: or
1.156 schwarze 637: .Fl W Cm warning
1.77 schwarze 638: was specified.
639: .It 5
640: Invalid command line arguments were specified.
641: No input files have been read.
642: .It 6
1.131 schwarze 643: An operating system error occurred, for example exhaustion
644: of memory, file descriptors, or process table entries.
1.77 schwarze 645: Such errors cause
646: .Nm
647: to exit at once, possibly in the middle of parsing or formatting a file.
648: .El
649: .Pp
650: Note that selecting
1.156 schwarze 651: .Fl T Cm lint
1.77 schwarze 652: output mode implies
1.156 schwarze 653: .Fl W Cm warning .
1.1 kristaps 654: .Sh EXAMPLES
1.13 kristaps 655: To page manuals to the terminal:
1.1 kristaps 656: .Pp
1.156 schwarze 657: .Dl $ mandoc \-W all,stop mandoc.1 2\*(Gt&1 | less
1.82 kristaps 658: .Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
1.28 kristaps 659: .Pp
1.41 kristaps 660: To produce HTML manuals with
1.164 schwarze 661: .Pa mandoc.css
1.41 kristaps 662: as the style-sheet:
1.38 kristaps 663: .Pp
1.164 schwarze 664: .Dl $ mandoc \-T html -O style=mandoc.css mdoc.7 \*(Gt mdoc.7.html
1.38 kristaps 665: .Pp
1.28 kristaps 666: To check over a large set of manuals:
667: .Pp
1.158 schwarze 668: .Dl $ mandoc \-T lint \(gafind /usr/src -name \e*\e.[1-9]\(ga
1.66 kristaps 669: .Pp
670: To produce a series of PostScript manuals for A4 paper:
671: .Pp
1.156 schwarze 672: .Dl $ mandoc \-T ps \-O paper=a4 mdoc.7 man.7 \*(Gt manuals.ps
1.91 schwarze 673: .Pp
674: Convert a modern
675: .Xr mdoc 7
676: manual to the older
677: .Xr man 7
678: format, for use on systems lacking an
679: .Xr mdoc 7
680: parser:
681: .Pp
1.156 schwarze 682: .Dl $ mandoc \-T man foo.mdoc \*(Gt foo.man
1.77 schwarze 683: .Sh DIAGNOSTICS
1.106 schwarze 684: Messages displayed by
685: .Nm
686: follow this format:
1.77 schwarze 687: .Pp
1.106 schwarze 688: .D1 Nm Ns : Ar file : Ns Ar line : Ns Ar column : level : message : macro args
1.77 schwarze 689: .Pp
1.106 schwarze 690: Line and column numbers start at 1.
691: Both are omitted for messages referring to an input file as a whole.
692: Macro names and arguments are omitted where meaningless.
693: Fatal messages about invalid command line arguments
694: or operating system errors, for example when memory is exhausted,
695: may also omit the
696: .Ar file
1.104 schwarze 697: and
1.106 schwarze 698: .Ar level
699: fields.
1.104 schwarze 700: .Pp
1.77 schwarze 701: Message levels have the following meanings:
702: .Bl -tag -width "warning"
1.133 schwarze 703: .It Cm unsupp
704: An input file uses unsupported low-level
705: .Xr roff 7
706: features.
707: The output may be incomplete and/or misformatted,
708: so using GNU troff instead of
709: .Nm
710: to process the file may be preferable.
1.77 schwarze 711: .It Cm error
1.133 schwarze 712: An input file contains invalid syntax that cannot be safely interpreted.
1.77 schwarze 713: By discarding part of the input or inserting missing tokens,
714: the parser is able to continue, and the error does not prevent
715: generation of formatted output, but typically, preparing that
716: output involves information loss, broken document structure
1.133 schwarze 717: or unintended formatting, no matter whether
718: .Nm
719: or GNU troff is used.
720: In many cases, the output of
721: .Nm
722: and GNU troff is identical, but in some,
723: .Nm
724: is more resilient than GNU troff with respect to malformed input.
1.131 schwarze 725: .Pp
726: Non-existent or unreadable input files are also reported on the
727: .Cm error
728: level.
729: In that case, the parser cannot even be started and no output
730: is produced from those input files.
1.77 schwarze 731: .It Cm warning
732: An input file uses obsolete, discouraged or non-portable syntax.
733: All the same, the meaning of the input is unambiguous and a correct
734: rendering can be produced.
735: Documents causing warnings may render poorly when using other
736: formatting tools instead of
737: .Nm .
738: .El
739: .Pp
740: Messages of the
1.133 schwarze 741: .Cm warning ,
742: .Cm error ,
1.77 schwarze 743: and
1.133 schwarze 744: .Cm unsupp
1.131 schwarze 745: levels except those about non-existent or unreadable input files
746: are hidden unless their level, or a lower level, is requested using a
1.77 schwarze 747: .Fl W
748: option or
1.156 schwarze 749: .Fl T Cm lint
1.77 schwarze 750: output mode.
1.106 schwarze 751: .Ss Warnings related to the document prologue
752: .Bl -ohang
753: .It Sy "missing manual title, using UNTITLED"
754: .Pq mdoc
755: A
756: .Ic \&Dt
757: macro has no arguments, or there is no
758: .Ic \&Dt
759: macro before the first non-prologue macro.
760: .It Sy "missing manual title, using \(dq\(dq"
761: .Pq man
762: There is no
763: .Ic \&TH
764: macro, or it has no arguments.
765: .It Sy "lower case character in document title"
766: .Pq mdoc , man
767: The title is still used as given in the
768: .Ic \&Dt
769: or
770: .Ic \&TH
771: macro.
772: .It Sy "missing manual section, using \(dq\(dq"
773: .Pq mdoc , man
774: A
775: .Ic \&Dt
776: or
777: .Ic \&TH
778: macro lacks the mandatory section argument.
779: .It Sy "unknown manual section"
780: .Pq mdoc
781: The section number in a
782: .Ic \&Dt
783: line is invalid, but still used.
784: .It Sy "missing date, using today's date"
785: .Pq mdoc, man
786: The document was parsed as
787: .Xr mdoc 7
788: and it has no
789: .Ic \&Dd
790: macro, or the
791: .Ic \&Dd
792: macro has no arguments or only empty arguments;
793: or the document was parsed as
794: .Xr man 7
795: and it has no
796: .Ic \&TH
797: macro, or the
798: .Ic \&TH
799: macro has less than three arguments or its third argument is empty.
800: .It Sy "cannot parse date, using it verbatim"
801: .Pq mdoc , man
802: The date given in a
803: .Ic \&Dd
804: or
805: .Ic \&TH
806: macro does not follow the conventional format.
807: .It Sy "missing Os macro, using \(dq\(dq"
808: .Pq mdoc
809: The default or current system is not shown in this case.
810: .It Sy "duplicate prologue macro"
811: .Pq mdoc
812: One of the prologue macros occurs more than once.
813: The last instance overrides all previous ones.
814: .It Sy "late prologue macro"
815: .Pq mdoc
816: A
817: .Ic \&Dd
818: or
819: .Ic \&Os
820: macro occurs after some non-prologue macro, but still takes effect.
821: .It Sy "skipping late title macro"
822: .Pq mdoc
823: The
824: .Ic \&Dt
1.152 schwarze 825: macro appears after the first non-prologue macro.
826: Traditional formatters cannot handle this because
827: they write the page header before parsing the document body.
1.106 schwarze 828: Even though this technical restriction does not apply to
829: .Nm ,
830: traditional semantics is preserved.
831: The late macro is discarded including its arguments.
832: .It Sy "prologue macros out of order"
833: .Pq mdoc
834: The prologue macros are not given in the conventional order
835: .Ic \&Dd ,
836: .Ic \&Dt ,
837: .Ic \&Os .
838: All three macros are used even when given in another order.
839: .El
840: .Ss Warnings regarding document structure
841: .Bl -ohang
842: .It Sy ".so is fragile, better use ln(1)"
843: .Pq roff
844: Including files only works when the parser program runs with the correct
845: current working directory.
846: .It Sy "no document body"
847: .Pq mdoc , man
848: The document body contains neither text nor macros.
849: An empty document is shown, consisting only of a header and a footer line.
850: .It Sy "content before first section header"
851: .Pq mdoc , man
852: Some macros or text precede the first
853: .Ic \&Sh
854: or
855: .Ic \&SH
856: section header.
857: The offending macros and text are parsed and added to the top level
858: of the syntax tree, outside any section block.
859: .It Sy "first section is not NAME"
860: .Pq mdoc
861: The argument of the first
862: .Ic \&Sh
863: macro is not
864: .Sq NAME .
865: This may confuse
866: .Xr makewhatis 8
867: and
868: .Xr apropos 1 .
1.168 schwarze 869: .It Sy "NAME section without Nm before Nd"
1.106 schwarze 870: .Pq mdoc
1.155 schwarze 871: The NAME section does not contain any
872: .Ic \&Nm
1.168 schwarze 873: child macro before the first
874: .Ic \&Nd
875: macro.
1.155 schwarze 876: .It Sy "NAME section without description"
877: .Pq mdoc
878: The NAME section lacks the mandatory
879: .Ic \&Nd
880: child macro.
881: .It Sy "description not at the end of NAME"
882: .Pq mdoc
883: The NAME section does contain an
1.106 schwarze 884: .Ic \&Nd
1.155 schwarze 885: child macro, but other content follows it.
886: .It Sy "bad NAME section content"
887: .Pq mdoc
888: The NAME section contains plain text or macros other than
889: .Ic \&Nm
1.106 schwarze 890: and
1.155 schwarze 891: .Ic \&Nd .
1.168 schwarze 892: .It Sy "missing comma before name"
893: .Pq mdoc
894: The NAME section contains an
895: .Ic \&Nm
896: macro that is neither the first one nor preceded by a comma.
1.142 schwarze 897: .It Sy "missing description line, using \(dq\(dq"
898: .Pq mdoc
899: The
900: .Ic \&Nd
901: macro lacks the required argument.
902: The title line of the manual will end after the dash.
1.106 schwarze 903: .It Sy "sections out of conventional order"
904: .Pq mdoc
905: A standard section occurs after another section it usually precedes.
906: All section titles are used as given,
907: and the order of sections is not changed.
908: .It Sy "duplicate section title"
909: .Pq mdoc
910: The same standard section title occurs more than once.
911: .It Sy "unexpected section"
912: .Pq mdoc
913: A standard section header occurs in a section of the manual
914: where it normally isn't useful.
1.112 schwarze 915: .It Sy "unusual Xr order"
916: .Pq mdoc
917: In the SEE ALSO section, an
918: .Ic \&Xr
919: macro with a lower section number follows one with a higher number,
920: or two
921: .Ic \&Xr
1.157 schwarze 922: macros referring to the same section are out of alphabetical order.
1.112 schwarze 923: .It Sy "unusual Xr punctuation"
924: .Pq mdoc
925: In the SEE ALSO section, punctuation between two
926: .Ic \&Xr
927: macros differs from a single comma, or there is trailing punctuation
928: after the last
929: .Ic \&Xr
930: macro.
1.111 schwarze 931: .It Sy "AUTHORS section without An macro"
932: .Pq mdoc
933: An AUTHORS sections contains no
934: .Ic \&An
935: macros, or only empty ones.
936: Probably, there are author names lacking markup.
1.106 schwarze 937: .El
938: .Ss "Warnings related to macros and nesting"
939: .Bl -ohang
940: .It Sy "obsolete macro"
941: .Pq mdoc
942: See the
943: .Xr mdoc 7
944: manual for replacements.
1.126 schwarze 945: .It Sy "macro neither callable nor escaped"
946: .Pq mdoc
947: The name of a macro that is not callable appears on a macro line.
948: It is printed verbatim.
1.152 schwarze 949: If the intention is to call it, move it to its own input line;
1.126 schwarze 950: otherwise, escape it by prepending
951: .Sq \e& .
1.106 schwarze 952: .It Sy "skipping paragraph macro"
953: In
954: .Xr mdoc 7
955: documents, this happens
956: .Bl -dash -compact
957: .It
958: at the beginning and end of sections and subsections
959: .It
960: right before non-compact lists and displays
961: .It
962: at the end of items in non-column, non-compact lists
963: .It
964: and for multiple consecutive paragraph macros.
965: .El
966: In
967: .Xr man 7
968: documents, it happens
969: .Bl -dash -compact
970: .It
971: for empty
972: .Ic \&P ,
973: .Ic \&PP ,
974: and
975: .Ic \&LP
976: macros
977: .It
978: for
979: .Ic \&IP
980: macros having neither head nor body arguments
981: .It
982: for
983: .Ic \&br
984: or
985: .Ic \&sp
986: right after
987: .Ic \&SH
988: or
989: .Ic \&SS
990: .El
991: .It Sy "moving paragraph macro out of list"
992: .Pq mdoc
993: A list item in a
994: .Ic \&Bl
995: list contains a trailing paragraph macro.
996: The paragraph macro is moved after the end of the list.
997: .It Sy "skipping no-space macro"
998: .Pq mdoc
999: An input line begins with an
1000: .Ic \&Ns
1001: macro.
1002: The macro is ignored.
1003: .It Sy "blocks badly nested"
1004: .Pq mdoc
1005: If two blocks intersect, one should completely contain the other.
1006: Otherwise, rendered output is likely to look strange in any output
1007: format, and rendering in SGML-based output formats is likely to be
1008: outright wrong because such languages do not support badly nested
1009: blocks at all.
1010: Typical examples of badly nested blocks are
1011: .Qq Ic \&Ao \&Bo \&Ac \&Bc
1012: and
1013: .Qq Ic \&Ao \&Bq \&Ac .
1014: In these examples,
1015: .Ic \&Ac
1016: breaks
1017: .Ic \&Bo
1018: and
1019: .Ic \&Bq ,
1020: respectively.
1021: .It Sy "nested displays are not portable"
1022: .Pq mdoc
1023: A
1024: .Ic \&Bd ,
1025: .Ic \&D1 ,
1026: or
1027: .Ic \&Dl
1028: display occurs nested inside another
1029: .Ic \&Bd
1030: display.
1031: This works with
1032: .Nm ,
1033: but fails with most other implementations.
1034: .It Sy "moving content out of list"
1035: .Pq mdoc
1036: A
1037: .Ic \&Bl
1038: list block contains text or macros before the first
1039: .Ic \&It
1040: macro.
1041: The offending children are moved before the beginning of the list.
1042: .It Sy "fill mode already enabled, skipping"
1043: .Pq man
1044: A
1045: .Ic \&fi
1046: request occurs even though the document is still in fill mode,
1047: or already switched back to fill mode.
1048: It has no effect.
1049: .It Sy "fill mode already disabled, skipping"
1050: .Pq man
1051: An
1052: .Ic \&nf
1053: request occurs even though the document already switched to no-fill mode
1054: and did not switch back to fill mode yet.
1055: It has no effect.
1056: .It Sy "line scope broken"
1057: .Pq man
1058: While parsing the next-line scope of the previous macro,
1059: another macro is found that prematurely terminates the previous one.
1060: The previous, interrupted macro is deleted from the parse tree.
1061: .El
1062: .Ss "Warnings related to missing arguments"
1063: .Bl -ohang
1064: .It Sy "skipping empty request"
1.118 schwarze 1065: .Pq roff , eqn
1066: The macro name is missing from a macro definition request,
1067: or an
1068: .Xr eqn 7
1069: control statement or operation keyword lacks its required argument.
1.106 schwarze 1070: .It Sy "conditional request controls empty scope"
1071: .Pq roff
1072: A conditional request is only useful if any of the following
1073: follows it on the same logical input line:
1074: .Bl -dash -compact
1075: .It
1076: The
1077: .Sq \e{
1078: keyword to open a multi-line scope.
1079: .It
1080: A request or macro or some text, resulting in a single-line scope.
1081: .It
1082: The immediate end of the logical line without any intervening whitespace,
1083: resulting in next-line scope.
1084: .El
1085: Here, a conditional request is followed by trailing whitespace only,
1086: and there is no other content on its logical input line.
1087: Note that it doesn't matter whether the logical input line is split
1088: across multiple physical input lines using
1089: .Sq \e
1090: line continuation characters.
1091: This is one of the rare cases
1092: where trailing whitespace is syntactically significant.
1093: The conditional request controls a scope containing whitespace only,
1094: so it is unlikely to have a significant effect,
1095: except that it may control a following
1096: .Ic \&el
1097: clause.
1098: .It Sy "skipping empty macro"
1099: .Pq mdoc
1.147 schwarze 1100: The indicated macro has no arguments and hence no effect.
1101: .It Sy "empty block"
1102: .Pq mdoc , man
1103: A
1104: .Ic \&Bd ,
1105: .Ic \&Bk ,
1106: .Ic \&Bl ,
1107: .Ic \&D1 ,
1108: .Ic \&Dl ,
1109: .Ic \&RS ,
1110: or
1111: .Ic \&UR
1112: block contains nothing in its body and will produce no output.
1.106 schwarze 1113: .It Sy "empty argument, using 0n"
1114: .Pq mdoc
1115: The required width is missing after
1116: .Ic \&Bd
1117: or
1118: .Ic \&Bl
1119: .Fl offset
1120: or
1121: .Fl width.
1122: .It Sy "missing display type, using -ragged"
1123: .Pq mdoc
1124: The
1125: .Ic \&Bd
1126: macro is invoked without the required display type.
1127: .It Sy "list type is not the first argument"
1128: .Pq mdoc
1129: In a
1130: .Ic \&Bl
1131: macro, at least one other argument precedes the type argument.
1132: The
1133: .Nm
1134: utility copes with any argument order, but some other
1135: .Xr mdoc 7
1136: implementations do not.
1137: .It Sy "missing -width in -tag list, using 8n"
1138: .Pq mdoc
1139: Every
1140: .Ic \&Bl
1141: macro having the
1142: .Fl tag
1143: argument requires
1144: .Fl width ,
1145: too.
1146: .It Sy "missing utility name, using \(dq\(dq"
1147: .Pq mdoc
1148: The
1149: .Ic \&Ex Fl std
1150: macro is called without an argument before
1151: .Ic \&Nm
1152: has first been called with an argument.
1.146 schwarze 1153: .It Sy "missing function name, using \(dq\(dq"
1154: .Pq mdoc
1155: The
1156: .Ic \&Fo
1157: macro is called without an argument.
1158: No function name is printed.
1.106 schwarze 1159: .It Sy "empty head in list item"
1160: .Pq mdoc
1161: In a
1162: .Ic \&Bl
1163: .Fl diag ,
1164: .Fl hang ,
1165: .Fl inset ,
1166: .Fl ohang ,
1167: or
1168: .Fl tag
1169: list, an
1170: .Ic \&It
1171: macro lacks the required argument.
1172: The item head is left empty.
1173: .It Sy "empty list item"
1174: .Pq mdoc
1175: In a
1176: .Ic \&Bl
1177: .Fl bullet ,
1178: .Fl dash ,
1179: .Fl enum ,
1180: or
1181: .Fl hyphen
1182: list, an
1183: .Ic \&It
1184: block is empty.
1185: An empty list item is shown.
1.152 schwarze 1186: .It Sy "missing font type, using \efR"
1.106 schwarze 1187: .Pq mdoc
1188: A
1189: .Ic \&Bf
1190: macro has no argument.
1.152 schwarze 1191: It switches to the default font.
1192: .It Sy "unknown font type, using \efR"
1.106 schwarze 1193: .Pq mdoc
1194: The
1195: .Ic \&Bf
1196: argument is invalid.
1.152 schwarze 1197: The default font is used instead.
1.127 schwarze 1198: .It Sy "nothing follows prefix"
1199: .Pq mdoc
1200: A
1201: .Ic \&Pf
1202: macro has no argument, or only one argument and no macro follows
1203: on the same input line.
1204: This defeats its purpose; in particular, spacing is not suppressed
1205: before the text or macros following on the next input line.
1.143 schwarze 1206: .It Sy "empty reference block"
1207: .Pq mdoc
1208: An
1209: .Ic \&Rs
1210: macro is immediately followed by an
1211: .Ic \&Re
1212: macro on the next input line.
1213: Such an empty block does not produce any output.
1.165 schwarze 1214: .It Sy "missing section argument"
1215: .Pq mdoc
1216: An
1217: .Ic \&Xr
1218: macro lacks its second, section number argument.
1219: The first argument, i.e. the name, is printed, but without subsequent
1.166 schwarze 1220: parentheses.
1.106 schwarze 1221: .It Sy "missing -std argument, adding it"
1222: .Pq mdoc
1223: An
1224: .Ic \&Ex
1225: or
1226: .Ic \&Rv
1227: macro lacks the required
1228: .Fl std
1229: argument.
1230: The
1231: .Nm
1232: utility assumes
1233: .Fl std
1234: even when it is not specified, but other implementations may not.
1.150 schwarze 1235: .It Sy "missing option string, using \(dq\(dq"
1236: .Pq man
1237: The
1238: .Ic \&OP
1239: macro is invoked without any argument.
1240: An empty pair of square brackets is shown.
1241: .It Sy "missing resource identifier, using \(dq\(dq"
1242: .Pq man
1243: The
1244: .Ic \&UR
1245: macro is invoked without any argument.
1246: An empty pair of angle brackets is shown.
1.118 schwarze 1247: .It Sy "missing eqn box, using \(dq\(dq"
1248: .Pq eqn
1249: A diacritic mark or a binary operator is found,
1250: but there is nothing to the left of it.
1251: An empty box is inserted.
1.106 schwarze 1252: .El
1253: .Ss "Warnings related to bad macro arguments"
1254: .Bl -ohang
1255: .It Sy "unterminated quoted argument"
1256: .Pq roff
1257: Macro arguments can be enclosed in double quote characters
1258: such that space characters and macro names contained in the quoted
1259: argument need not be escaped.
1260: The closing quote of the last argument of a macro can be omitted.
1261: However, omitting it is not recommended because it makes the code
1262: harder to read.
1263: .It Sy "duplicate argument"
1264: .Pq mdoc
1265: A
1266: .Ic \&Bd
1267: or
1268: .Ic \&Bl
1269: macro has more than one
1270: .Fl compact ,
1271: more than one
1272: .Fl offset ,
1273: or more than one
1274: .Fl width
1275: argument.
1276: All but the last instances of these arguments are ignored.
1277: .It Sy "skipping duplicate argument"
1278: .Pq mdoc
1279: An
1280: .Ic \&An
1281: macro has more than one
1282: .Fl split
1283: or
1284: .Fl nosplit
1285: argument.
1286: All but the first of these arguments are ignored.
1287: .It Sy "skipping duplicate display type"
1288: .Pq mdoc
1289: A
1290: .Ic \&Bd
1291: macro has more than one type argument; the first one is used.
1292: .It Sy "skipping duplicate list type"
1293: .Pq mdoc
1294: A
1295: .Ic \&Bl
1296: macro has more than one type argument; the first one is used.
1297: .It Sy "skipping -width argument"
1298: .Pq mdoc
1299: A
1300: .Ic \&Bl
1301: .Fl column ,
1302: .Fl diag ,
1303: .Fl ohang ,
1304: .Fl inset ,
1305: or
1306: .Fl item
1307: list has a
1308: .Fl width
1309: argument.
1310: That has no effect.
1.151 schwarze 1311: .It Sy "wrong number of cells"
1312: In a line of a
1313: .Ic \&Bl Fl column
1314: list, the number of tabs or
1315: .Ic \&Ta
1316: macros is less than the number expected from the list header line
1317: or exceeds the expected number by more than one.
1318: Missing cells remain empty, and all cells exceeding the number of
1319: columns are joined into one single cell.
1.106 schwarze 1320: .It Sy "unknown AT&T UNIX version"
1321: .Pq mdoc
1322: An
1323: .Ic \&At
1324: macro has an invalid argument.
1325: It is used verbatim, with
1326: .Qq "AT&T UNIX "
1327: prefixed to it.
1.113 schwarze 1328: .It Sy "comma in function argument"
1329: .Pq mdoc
1330: An argument of an
1331: .Ic \&Fa
1332: or
1333: .Ic \&Fn
1334: macro contains a comma; it should probably be split into two arguments.
1.117 schwarze 1335: .It Sy "parenthesis in function name"
1336: .Pq mdoc
1337: The first argument of an
1338: .Ic \&Fc
1339: or
1340: .Ic \&Fn
1341: macro contains an opening or closing parenthesis; that's probably wrong,
1342: parentheses are added automatically.
1.106 schwarze 1343: .It Sy "invalid content in Rs block"
1344: .Pq mdoc
1345: An
1346: .Ic \&Rs
1347: block contains plain text or non-% macros.
1348: The bogus content is left in the syntax tree.
1349: Formatting may be poor.
1350: .It Sy "invalid Boolean argument"
1351: .Pq mdoc
1352: An
1353: .Ic \&Sm
1354: macro has an argument other than
1355: .Cm on
1356: or
1357: .Cm off .
1358: The invalid argument is moved out of the macro, which leaves the macro
1359: empty, causing it to toggle the spacing mode.
1360: .It Sy "unknown font, skipping request"
1.115 schwarze 1361: .Pq man , tbl
1.106 schwarze 1362: A
1363: .Xr roff 7
1364: .Ic \&ft
1.115 schwarze 1365: request or a
1366: .Xr tbl 7
1367: .Ic \&f
1368: layout modifier has an unknown
1369: .Ar font
1370: argument.
1.151 schwarze 1371: .It Sy "odd number of characters in request"
1372: .Pq roff
1373: A
1374: .Ic \&tr
1375: request contains an odd number of characters.
1376: The last character is mapped to the blank character.
1.106 schwarze 1377: .El
1378: .Ss "Warnings related to plain text"
1379: .Bl -ohang
1380: .It Sy "blank line in fill mode, using .sp"
1381: .Pq mdoc
1382: The meaning of blank input lines is only well-defined in non-fill mode:
1383: In fill mode, line breaks of text input lines are not supposed to be
1384: significant.
1385: However, for compatibility with groff, blank lines in fill mode
1386: are replaced with
1387: .Ic \&sp
1388: requests.
1389: .It Sy "tab in filled text"
1390: .Pq mdoc , man
1391: The meaning of tab characters is only well-defined in non-fill mode:
1392: In fill mode, whitespace is not supposed to be significant
1393: on text input lines.
1394: As an implementation dependent choice, tab characters on text lines
1395: are passed through to the formatters in any case.
1396: Given that the text before the tab character will be filled,
1397: it is hard to predict which tab stop position the tab will advance to.
1398: .It Sy "whitespace at end of input line"
1399: .Pq mdoc , man , roff
1400: Whitespace at the end of input lines is almost never semantically
1401: significant \(em but in the odd case where it might be, it is
1402: extremely confusing when reviewing and maintaining documents.
1.172 schwarze 1403: .It Sy "new sentence, new line"
1404: .Pq mdoc
1405: A new sentence starts in the middle of a text line.
1406: Start it on a new input line to help formatters produce correct spacing.
1.106 schwarze 1407: .It Sy "bad comment style"
1408: .Pq roff
1409: Comment lines start with a dot, a backslash, and a double-quote character.
1410: The
1411: .Nm
1412: utility treats the line as a comment line even without the backslash,
1413: but leaving out the backslash might not be portable.
1414: .It Sy "invalid escape sequence"
1415: .Pq roff
1416: An escape sequence has an invalid opening argument delimiter, lacks the
1417: closing argument delimiter, or the argument has too few characters.
1418: If the argument is incomplete,
1419: .Ic \e*
1420: and
1421: .Ic \en
1422: expand to an empty string,
1423: .Ic \eB
1424: to the digit
1425: .Sq 0 ,
1426: and
1427: .Ic \ew
1428: to the length of the incomplete argument.
1429: All other invalid escape sequences are ignored.
1430: .It Sy "undefined string, using \(dq\(dq"
1431: .Pq roff
1432: If a string is used without being defined before,
1433: its value is implicitly set to the empty string.
1434: However, defining strings explicitly before use
1435: keeps the code more readable.
1436: .El
1.138 schwarze 1437: .Ss "Warnings related to tables"
1438: .Bl -ohang
1439: .It Sy "tbl line starts with span"
1440: .Pq tbl
1441: The first cell in a table layout line is a horizontal span
1442: .Pq Sq Cm s .
1443: Data provided for this cell is ignored, and nothing is printed in the cell.
1444: .It Sy "tbl column starts with span"
1445: .Pq tbl
1446: The first line of a table layout specification
1447: requests a vertical span
1448: .Pq Sq Cm ^ .
1449: Data provided for this cell is ignored, and nothing is printed in the cell.
1450: .It Sy "skipping vertical bar in tbl layout"
1451: .Pq tbl
1452: A table layout specification contains more than two consecutive vertical bars.
1453: A double bar is printed, all additional bars are discarded.
1.106 schwarze 1454: .El
1455: .Ss "Errors related to tables"
1.136 schwarze 1456: .Bl -ohang
1457: .It Sy "non-alphabetic character in tbl options"
1458: .Pq tbl
1459: The table options line contains a character other than a letter,
1460: blank, or comma where the beginning of an option name is expected.
1461: The character is ignored.
1462: .It Sy "skipping unknown tbl option"
1463: .Pq tbl
1464: The table options line contains a string of letters that does not
1465: match any known option name.
1466: The word is ignored.
1467: .It Sy "missing tbl option argument"
1468: .Pq tbl
1469: A table option that requires an argument is not followed by an
1470: opening parenthesis, or the opening parenthesis is immediately
1471: followed by a closing parenthesis.
1472: The option is ignored.
1473: .It Sy "wrong tbl option argument size"
1474: .Pq tbl
1475: A table option argument contains an invalid number of characters.
1476: Both the option and the argument are ignored.
1.138 schwarze 1477: .It Sy "empty tbl layout"
1478: .Pq tbl
1479: A table layout specification is completely empty,
1480: specifying zero lines and zero columns.
1481: As a fallback, a single left-justified column is used.
1482: .It Sy "invalid character in tbl layout"
1483: .Pq tbl
1484: A table layout specification contains a character that can neither
1485: be interpreted as a layout key character nor as a layout modifier,
1486: or a modifier precedes the first key.
1487: The invalid character is discarded.
1488: .It Sy "unmatched parenthesis in tbl layout"
1489: .Pq tbl
1490: A table layout specification contains an opening parenthesis,
1491: but no matching closing parenthesis.
1492: The rest of the input line, starting from the parenthesis, has no effect.
1.139 schwarze 1493: .It Sy "tbl without any data cells"
1494: .Pq tbl
1495: A table does not contain any data cells.
1496: It will probably produce no output.
1497: .It Sy "ignoring data in spanned tbl cell"
1498: .Pq tbl
1499: A table cell is marked as a horizontal span
1500: .Pq Sq Cm s
1501: or vertical span
1502: .Pq Sq Cm ^
1503: in the table layout, but it contains data.
1504: The data is ignored.
1505: .It Sy "ignoring extra tbl data cells"
1506: .Pq tbl
1507: A data line contains more cells than the corresponding layout line.
1508: The data in the extra cells is ignored.
1509: .It Sy "data block open at end of tbl"
1510: .Pq tbl
1511: A data block is opened with
1512: .Cm T{ ,
1513: but never closed with a matching
1514: .Cm T} .
1515: The remaining data lines of the table are all put into one cell,
1516: and any remaining cells stay empty.
1.106 schwarze 1517: .El
1518: .Ss "Errors related to roff, mdoc, and man code"
1519: .Bl -ohang
1520: .It Sy "input stack limit exceeded, infinite loop?"
1521: .Pq roff
1522: Explicit recursion limits are implemented for the following features,
1523: in order to prevent infinite loops:
1524: .Bl -dash -compact
1525: .It
1526: expansion of nested escape sequences
1527: including expansion of strings and number registers,
1528: .It
1529: expansion of nested user-defined macros,
1530: .It
1531: and
1532: .Ic \&so
1533: file inclusion.
1534: .El
1535: When a limit is hit, the output is incorrect, typically losing
1536: some content, but the parser can continue.
1537: .It Sy "skipping bad character"
1538: .Pq mdoc , man , roff
1539: The input file contains a byte that is not a printable
1540: .Xr ascii 7
1541: character.
1542: The message mentions the character number.
1543: The offending byte is replaced with a question mark
1544: .Pq Sq \&? .
1545: Consider editing the input file to replace the byte with an ASCII
1546: transliteration of the intended character.
1547: .It Sy "skipping unknown macro"
1548: .Pq mdoc , man , roff
1549: The first identifier on a request or macro line is neither recognized as a
1550: .Xr roff 7
1551: request, nor as a user-defined macro, nor, respectively, as an
1552: .Xr mdoc 7
1553: or
1554: .Xr man 7
1555: macro.
1556: It may be mistyped or unsupported.
1557: The request or macro is discarded including its arguments.
1.133 schwarze 1558: .It Sy "skipping insecure request"
1559: .Pq roff
1560: An input file attempted to run a shell command
1561: or to read or write an external file.
1562: Such attempts are denied for security reasons.
1.106 schwarze 1563: .It Sy "skipping item outside list"
1.118 schwarze 1564: .Pq mdoc , eqn
1.106 schwarze 1565: An
1566: .Ic \&It
1567: macro occurs outside any
1568: .Ic \&Bl
1.118 schwarze 1569: list, or an
1570: .Xr eqn 7
1571: .Ic above
1572: delimiter occurs outside any pile.
1.106 schwarze 1573: It is discarded including its arguments.
1574: .It Sy "skipping column outside column list"
1575: .Pq mdoc
1576: A
1577: .Ic \&Ta
1578: macro occurs outside any
1579: .Ic \&Bl Fl column
1580: block.
1581: It is discarded including its arguments.
1582: .It Sy "skipping end of block that is not open"
1583: .Pq mdoc , man , eqn , tbl , roff
1584: Various syntax elements can only be used to explicitly close blocks
1585: that have previously been opened.
1586: An
1587: .Xr mdoc 7
1588: block closing macro, a
1589: .Xr man 7
1590: .Ic \&RE
1591: or
1592: .Ic \&UE
1.118 schwarze 1593: macro, an
1594: .Xr eqn 7
1595: right delimiter or closing brace, or the end of an equation, table, or
1.106 schwarze 1596: .Xr roff 7
1597: conditional request is encountered but no matching block is open.
1598: The offending request or macro is discarded.
1.135 schwarze 1599: .It Sy "fewer RS blocks open, skipping"
1600: .Pq man
1601: The
1602: .Ic \&RE
1603: macro is invoked with an argument, but less than the specified number of
1604: .Ic \&RS
1605: blocks is open.
1606: The
1607: .Ic \&RE
1608: macro is discarded.
1.106 schwarze 1609: .It Sy "inserting missing end of block"
1610: .Pq mdoc , tbl
1611: Various
1612: .Xr mdoc 7
1613: macros as well as tables require explicit closing by dedicated macros.
1614: A block that doesn't support bad nesting
1615: ends before all of its children are properly closed.
1616: The open child nodes are closed implicitly.
1.152 schwarze 1617: .It Sy "appending missing end of block"
1.106 schwarze 1618: .Pq mdoc , man , eqn , tbl , roff
1619: At the end of the document, an explicit
1620: .Xr mdoc 7
1621: block, a
1622: .Xr man 7
1623: next-line scope or
1624: .Ic \&RS
1625: or
1626: .Ic \&UR
1627: block, an equation, table, or
1628: .Xr roff 7
1629: conditional or ignore block is still open.
1630: The open block is closed implicitly.
1631: .It Sy "escaped character not allowed in a name"
1632: .Pq roff
1633: Macro, string and register identifiers consist of printable,
1634: non-whitespace ASCII characters.
1635: Escape sequences and characters and strings expressed in terms of them
1636: cannot form part of a name.
1637: The first argument of an
1638: .Ic \&am ,
1639: .Ic \&as ,
1640: .Ic \&de ,
1641: .Ic \&ds ,
1642: .Ic \&nr ,
1643: or
1644: .Ic \&rr
1645: request, or any argument of an
1646: .Ic \&rm
1647: request, or the name of a request or user defined macro being called,
1648: is terminated by an escape sequence.
1649: In the cases of
1650: .Ic \&as ,
1651: .Ic \&ds ,
1652: and
1653: .Ic \&nr ,
1654: the request has no effect at all.
1655: In the cases of
1656: .Ic \&am ,
1657: .Ic \&de ,
1658: .Ic \&rr ,
1659: and
1660: .Ic \&rm ,
1661: what was parsed up to this point is used as the arguments to the request,
1662: and the rest of the input line is discarded including the escape sequence.
1663: When parsing for a request or a user-defined macro name to be called,
1664: only the escape sequence is discarded.
1665: The characters preceding it are used as the request or macro name,
1666: the characters following it are used as the arguments to the request or macro.
1.124 schwarze 1667: .It Sy "NOT IMPLEMENTED: Bd -file"
1668: .Pq mdoc
1669: For security reasons, the
1670: .Ic \&Bd
1671: macro does not support the
1672: .Fl file
1673: argument.
1674: By requesting the inclusion of a sensitive file, a malicious document
1675: might otherwise trick a privileged user into inadvertently displaying
1676: the file on the screen, revealing the file content to bystanders.
1677: The argument is ignored including the file name following it.
1.163 schwarze 1678: .It Sy "skipping display without arguments"
1679: .Pq mdoc
1680: A
1681: .Ic \&Bd
1682: block macro does not have any arguments.
1683: The block is discarded, and the block content is displayed in
1684: whatever mode was active before the block.
1.106 schwarze 1685: .It Sy "missing list type, using -item"
1686: .Pq mdoc
1687: A
1688: .Ic \&Bl
1689: macro fails to specify the list type.
1690: .It Sy "missing manual name, using \(dq\(dq"
1691: .Pq mdoc
1692: The first call to
1.168 schwarze 1693: .Ic \&Nm ,
1694: or any call in the NAME section, lacks the required argument.
1.106 schwarze 1695: .It Sy "uname(3) system call failed, using UNKNOWN"
1696: .Pq mdoc
1697: The
1698: .Ic \&Os
1699: macro is called without arguments, and the
1700: .Xr uname 3
1701: system call failed.
1702: As a workaround,
1703: .Nm
1704: can be compiled with
1705: .Sm off
1706: .Fl D Cm OSNAME=\(dq\e\(dq Ar string Cm \e\(dq\(dq .
1707: .Sm on
1708: .It Sy "unknown standard specifier"
1709: .Pq mdoc
1710: An
1711: .Ic \&St
1712: macro has an unknown argument and is discarded.
1713: .It Sy "skipping request without numeric argument"
1.118 schwarze 1714: .Pq roff , eqn
1.106 schwarze 1715: An
1716: .Ic \&it
1.118 schwarze 1717: request or an
1718: .Xr eqn 7
1719: .Ic \&size
1720: or
1721: .Ic \&gsize
1722: statement has a non-numeric or negative argument or no argument at all.
1723: The invalid request or statement is ignored.
1.132 schwarze 1724: .It Sy "NOT IMPLEMENTED: .so with absolute path or \(dq..\(dq"
1725: .Pq roff
1726: For security reasons,
1727: .Nm
1728: allows
1729: .Ic \&so
1730: file inclusion requests only with relative paths
1731: and only without ascending to any parent directory.
1732: By requesting the inclusion of a sensitive file, a malicious document
1733: might otherwise trick a privileged user into inadvertently displaying
1734: the file on the screen, revealing the file content to bystanders.
1735: .Nm
1736: only shows the path as it appears behind
1737: .Ic \&so .
1738: .It Sy ".so request failed"
1739: .Pq roff
1740: Servicing a
1741: .Ic \&so
1742: request requires reading an external file, but the file could not be
1743: opened.
1744: .Nm
1745: only shows the path as it appears behind
1746: .Ic \&so .
1.106 schwarze 1747: .It Sy "skipping all arguments"
1748: .Pq mdoc , man , eqn , roff
1749: An
1750: .Xr mdoc 7
1751: .Ic \&Bt ,
1752: .Ic \&Ed ,
1753: .Ic \&Ef ,
1754: .Ic \&Ek ,
1755: .Ic \&El ,
1.144 schwarze 1756: .Ic \&Lp ,
1757: .Ic \&Pp ,
1.106 schwarze 1758: .Ic \&Re ,
1.143 schwarze 1759: .Ic \&Rs ,
1.106 schwarze 1760: or
1761: .Ic \&Ud
1762: macro, an
1763: .Ic \&It
1764: macro in a list that don't support item heads, a
1765: .Xr man 7
1766: .Ic \&LP ,
1767: .Ic \&P ,
1768: or
1769: .Ic \&PP
1770: macro, an
1771: .Xr eqn 7
1.120 schwarze 1772: .Ic \&EQ
1773: or
1.106 schwarze 1774: .Ic \&EN
1775: macro, or a
1776: .Xr roff 7
1.148 schwarze 1777: .Ic \&br ,
1778: .Ic \&fi ,
1779: or
1780: .Ic \&nf
1.144 schwarze 1781: request or
1.106 schwarze 1782: .Sq \&..
1783: block closing request is invoked with at least one argument.
1784: All arguments are ignored.
1785: .It Sy "skipping excess arguments"
1.135 schwarze 1786: .Pq mdoc , man , roff
1.150 schwarze 1787: A macro or request is invoked with too many arguments:
1788: .Bl -dash -offset 2n -width 2n -compact
1789: .It
1790: .Ic \&Fo ,
1791: .Ic \&PD ,
1792: .Ic \&RS ,
1793: .Ic \&UR ,
1794: .Ic \&ft ,
1795: or
1796: .Ic \&sp
1797: with more than one argument
1798: .It
1.144 schwarze 1799: .Ic \&An
1.150 schwarze 1800: with another argument after
1.144 schwarze 1801: .Fl split
1802: or
1.150 schwarze 1803: .Fl nosplit
1804: .It
1805: .Ic \&RE
1806: with more than one argument or with a non-integer argument
1807: .It
1808: .Ic \&OP
1809: or a request of the
1810: .Ic \&de
1811: family with more than two arguments
1.154 schwarze 1812: .It
1813: .Ic \&Dt
1814: with more than three arguments
1.150 schwarze 1815: .It
1816: .Ic \&TH
1817: with more than five arguments
1818: .It
1.145 schwarze 1819: .Ic \&Bd ,
1820: .Ic \&Bk ,
1821: or
1822: .Ic \&Bl
1.150 schwarze 1823: with invalid arguments
1824: .El
1.106 schwarze 1825: The excess arguments are ignored.
1.133 schwarze 1826: .El
1827: .Ss Unsupported features
1828: .Bl -ohang
1829: .It Sy "input too large"
1830: .Pq mdoc , man
1831: Currently,
1832: .Nm
1833: cannot handle input files larger than its arbitrary size limit
1834: of 2^31 bytes (2 Gigabytes).
1835: Since useful manuals are always small, this is not a problem in practice.
1836: Parsing is aborted as soon as the condition is detected.
1.136 schwarze 1837: .It Sy "unsupported control character"
1838: .Pq roff
1839: An ASCII control character supported by other
1840: .Xr roff 7
1841: implementations but not by
1842: .Nm
1843: was found in an input file.
1844: It is replaced by a question mark.
1.133 schwarze 1845: .It Sy "unsupported roff request"
1846: .Pq roff
1847: An input file contains a
1848: .Xr roff 7
1849: request supported by GNU troff or Heirloom troff but not by
1850: .Nm ,
1851: and it is likely that this will cause information loss
1852: or considerable misformatting.
1.139 schwarze 1853: .It Sy "eqn delim option in tbl"
1854: .Pq eqn , tbl
1855: The options line of a table defines equation delimiters.
1856: Any equation source code contained in the table will be printed unformatted.
1857: .It Sy "unsupported table layout modifier"
1.138 schwarze 1858: .Pq tbl
1859: A table layout specification contains an
1860: .Sq Cm m
1861: modifier.
1862: The modifier is discarded.
1.133 schwarze 1863: .It Sy "ignoring macro in table"
1.139 schwarze 1864: .Pq tbl , mdoc , man
1865: A table contains an invocation of an
1866: .Xr mdoc 7
1867: or
1868: .Xr man 7
1869: macro or of an undefined macro.
1870: The macro is ignored, and its arguments are handled
1871: as if they were a text line.
1.106 schwarze 1872: .El
1.1 kristaps 1873: .Sh SEE ALSO
1.141 schwarze 1874: .Xr apropos 1 ,
1875: .Xr man 1 ,
1.85 kristaps 1876: .Xr eqn 7 ,
1.57 kristaps 1877: .Xr man 7 ,
1.13 kristaps 1878: .Xr mandoc_char 7 ,
1.84 kristaps 1879: .Xr mdoc 7 ,
1880: .Xr roff 7 ,
1881: .Xr tbl 7
1.173 schwarze 1882: .Sh HISTORY
1883: The
1884: .Nm
1885: utility first appeared in
1886: .Ox 4.8 .
1887: The option
1888: .Fl I
1889: appeared in
1890: .Ox 5.2 ,
1891: and
1892: .Fl aCcfhKklMSsw
1893: in
1894: .Ox 5.7 .
1.1 kristaps 1895: .Sh AUTHORS
1.156 schwarze 1896: .An -nosplit
1.1 kristaps 1897: The
1898: .Nm
1.26 kristaps 1899: utility was written by
1.141 schwarze 1900: .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
1901: and is maintained by
1902: .An Ingo Schwarze Aq Mt schwarze@openbsd.org .
CVSweb