]> git.cameronkatri.com Git - mandoc.git/blob - mandoc.1
warn about AUTHORS sections without .An macros, inspired by mdoclint(1)
[mandoc.git] / mandoc.1
1 .\" $Id: mandoc.1,v 1.111 2014/09/07 23:25:01 schwarze Exp $
2 .\"
3 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
5 .\"
6 .\" Permission to use, copy, modify, and distribute this software for any
7 .\" purpose with or without fee is hereby granted, provided that the above
8 .\" copyright notice and this permission notice appear in all copies.
9 .\"
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.
17 .\"
18 .Dd $Mdocdate: September 7 2014 $
19 .Dt MANDOC 1
20 .Os
21 .Sh NAME
22 .Nm mandoc
23 .Nd format and display UNIX manuals
24 .Sh SYNOPSIS
25 .Nm mandoc
26 .Op Fl acfhklV
27 .Sm off
28 .Op Fl I Cm os Li = Ar name
29 .Sm on
30 .Op Fl m Ns Ar format
31 .Op Fl O Ns Ar option
32 .Op Fl T Ns Ar output
33 .Op Fl W Ns Ar level
34 .Op Ar
35 .Sh DESCRIPTION
36 The
37 .Nm
38 utility formats
39 .Ux
40 manual pages for display.
41 .Pp
42 By default,
43 .Nm
44 reads
45 .Xr mdoc 7
46 or
47 .Xr man 7
48 text from stdin, implying
49 .Fl m Ns Cm andoc ,
50 and produces
51 .Fl T Ns Cm ascii
52 output.
53 .Pp
54 The options are as follows:
55 .Bl -tag -width Ds
56 .It Fl a
57 If the standard output is a terminal device and
58 .Fl c
59 is not specified, use
60 .Xr more 1
61 to paginate the output, just like
62 .Xr man 1
63 would.
64 .It Fl c
65 Copy the formatted manual pages to the standard output without using
66 .Xr more 1
67 to paginate them.
68 This is the default.
69 It can be specified to override
70 .Fl a .
71 .It Fl f
72 A synonym for
73 .Xr whatis 1 .
74 This overrides any earlier
75 .Fl k
76 and
77 .Fl l
78 options.
79 .Sm off
80 .It Fl I Cm os Li = Ar name
81 .Sm on
82 Override the default operating system
83 .Ar name
84 for the
85 .Xr mdoc 7
86 .Sq \&Os
87 macro.
88 .It Fl h
89 Display only the SYNOPSIS lines.
90 Implies
91 .Fl a .
92 .It Fl k
93 A synonym for
94 .Xr apropos 1 .
95 This overrides any earlier
96 .Fl f
97 and
98 .Fl l
99 options.
100 .It Fl l
101 A synonym for
102 .Fl a .
103 Also reverts any earlier
104 .Fl f
105 and
106 .Fl k
107 options.
108 .It Fl m Ns Ar format
109 Input format.
110 See
111 .Sx Input Formats
112 for available formats.
113 Defaults to
114 .Fl m Ns Cm andoc .
115 .It Fl O Ns Ar option
116 Comma-separated output options.
117 .It Fl T Ns Ar output
118 Output format.
119 See
120 .Sx Output Formats
121 for available formats.
122 Defaults to
123 .Fl T Ns Cm ascii .
124 .It Fl V
125 Print version and exit.
126 .It Fl W Ns Ar level
127 Specify the minimum message
128 .Ar level
129 to be reported on the standard error output and to affect the exit status.
130 The
131 .Ar level
132 can be
133 .Cm warning ,
134 .Cm error ,
135 or
136 .Cm fatal .
137 The default is
138 .Fl W Ns Cm fatal ;
139 .Fl W Ns Cm all
140 is an alias for
141 .Fl W Ns Cm warning .
142 See
143 .Sx EXIT STATUS
144 and
145 .Sx DIAGNOSTICS
146 for details.
147 .Pp
148 The special option
149 .Fl W Ns Cm stop
150 tells
151 .Nm
152 to exit after parsing a file that causes warnings or errors of at least
153 the requested level.
154 No formatted output will be produced from that file.
155 If both a
156 .Ar level
157 and
158 .Cm stop
159 are requested, they can be joined with a comma, for example
160 .Fl W Ns Cm error , Ns Cm stop .
161 .It Ar file
162 Read input from zero or more files.
163 If unspecified, reads from stdin.
164 If multiple files are specified,
165 .Nm
166 will halt with the first failed parse.
167 .El
168 .Pp
169 In
170 .Fl f
171 and
172 .Fl k
173 mode,
174 .Nm
175 also supports the options
176 .Fl CMmOSsw
177 described in the
178 .Xr apropos 1
179 manual.
180 .Ss Input Formats
181 The
182 .Nm
183 utility accepts
184 .Xr mdoc 7
185 and
186 .Xr man 7
187 input with
188 .Fl m Ns Cm doc
189 and
190 .Fl m Ns Cm an ,
191 respectively.
192 The
193 .Xr mdoc 7
194 format is
195 .Em strongly
196 recommended;
197 .Xr man 7
198 should only be used for legacy manuals.
199 .Pp
200 A third option,
201 .Fl m Ns Cm andoc ,
202 which is also the default, determines encoding on-the-fly: if the first
203 non-comment macro is
204 .Sq \&Dd
205 or
206 .Sq \&Dt ,
207 the
208 .Xr mdoc 7
209 parser is used; otherwise, the
210 .Xr man 7
211 parser is used.
212 .Pp
213 If multiple
214 files are specified with
215 .Fl m Ns Cm andoc ,
216 each has its file-type determined this way.
217 If multiple files are
218 specified and
219 .Fl m Ns Cm doc
220 or
221 .Fl m Ns Cm an
222 is specified, then this format is used exclusively.
223 .Ss Output Formats
224 The
225 .Nm
226 utility accepts the following
227 .Fl T
228 arguments, which correspond to output modes:
229 .Bl -tag -width "-Tlocale"
230 .It Fl T Ns Cm ascii
231 Produce 7-bit ASCII output.
232 This is the default.
233 See
234 .Sx ASCII Output .
235 .It Fl T Ns Cm html
236 Produce strict CSS1/HTML-4.01 output.
237 See
238 .Sx HTML Output .
239 .It Fl T Ns Cm lint
240 Parse only: produce no output.
241 Implies
242 .Fl W Ns Cm warning .
243 .It Fl T Ns Cm locale
244 Encode output using the current locale.
245 See
246 .Sx Locale Output .
247 .It Fl T Ns Cm man
248 Produce
249 .Xr man 7
250 format output.
251 See
252 .Sx Man Output .
253 .It Fl T Ns Cm pdf
254 Produce PDF output.
255 See
256 .Sx PDF Output .
257 .It Fl T Ns Cm ps
258 Produce PostScript output.
259 See
260 .Sx PostScript Output .
261 .It Fl T Ns Cm tree
262 Produce an indented parse tree.
263 .It Fl T Ns Cm utf8
264 Encode output in the UTF\-8 multi-byte format.
265 See
266 .Sx UTF\-8 Output .
267 .It Fl T Ns Cm xhtml
268 Produce strict CSS1/XHTML-1.0 output.
269 See
270 .Sx XHTML Output .
271 .El
272 .Pp
273 If multiple input files are specified, these will be processed by the
274 corresponding filter in-order.
275 .Ss ASCII Output
276 Output produced by
277 .Fl T Ns Cm ascii ,
278 which is the default, is rendered in standard 7-bit ASCII documented in
279 .Xr ascii 7 .
280 .Pp
281 Font styles are applied by using back-spaced encoding such that an
282 underlined character
283 .Sq c
284 is rendered as
285 .Sq _ Ns \e[bs] Ns c ,
286 where
287 .Sq \e[bs]
288 is the back-space character number 8.
289 Emboldened characters are rendered as
290 .Sq c Ns \e[bs] Ns c .
291 .Pp
292 The special characters documented in
293 .Xr mandoc_char 7
294 are rendered best-effort in an ASCII equivalent.
295 If no equivalent is found,
296 .Sq \&?
297 is used instead.
298 .Pp
299 Output width is limited to 78 visible columns unless literal input lines
300 exceed this limit.
301 .Pp
302 The following
303 .Fl O
304 arguments are accepted:
305 .Bl -tag -width Ds
306 .It Cm indent Ns = Ns Ar indent
307 The left margin for normal text is set to
308 .Ar indent
309 blank characters instead of the default of five for
310 .Xr mdoc 7
311 and seven for
312 .Xr man 7 .
313 Increasing this is not recommended; it may result in degraded formatting,
314 for example overfull lines or ugly line breaks.
315 .It Cm width Ns = Ns Ar width
316 The output width is set to
317 .Ar width ,
318 which will normalise to \(>=60.
319 .El
320 .Ss HTML Output
321 Output produced by
322 .Fl T Ns Cm html
323 conforms to HTML-4.01 strict.
324 .Pp
325 The
326 .Pa example.style.css
327 file documents style-sheet classes available for customising output.
328 If a style-sheet is not specified with
329 .Fl O Ns Ar style ,
330 .Fl T Ns Cm html
331 defaults to simple output readable in any graphical or text-based web
332 browser.
333 .Pp
334 Special characters are rendered in decimal-encoded UTF\-8.
335 .Pp
336 The following
337 .Fl O
338 arguments are accepted:
339 .Bl -tag -width Ds
340 .It Cm fragment
341 Omit the
342 .Aq !DOCTYPE
343 declaration and the
344 .Aq html ,
345 .Aq head ,
346 and
347 .Aq body
348 elements and only emit the subtree below the
349 .Aq body
350 element.
351 The
352 .Cm style
353 argument will be ignored.
354 This is useful when embedding manual content within existing documents.
355 .It Cm includes Ns = Ns Ar fmt
356 The string
357 .Ar fmt ,
358 for example,
359 .Ar ../src/%I.html ,
360 is used as a template for linked header files (usually via the
361 .Sq \&In
362 macro).
363 Instances of
364 .Sq \&%I
365 are replaced with the include filename.
366 The default is not to present a
367 hyperlink.
368 .It Cm man Ns = Ns Ar fmt
369 The string
370 .Ar fmt ,
371 for example,
372 .Ar ../html%S/%N.%S.html ,
373 is used as a template for linked manuals (usually via the
374 .Sq \&Xr
375 macro).
376 Instances of
377 .Sq \&%N
378 and
379 .Sq %S
380 are replaced with the linked manual's name and section, respectively.
381 If no section is included, section 1 is assumed.
382 The default is not to
383 present a hyperlink.
384 .It Cm style Ns = Ns Ar style.css
385 The file
386 .Ar style.css
387 is used for an external style-sheet.
388 This must be a valid absolute or
389 relative URI.
390 .El
391 .Ss Locale Output
392 Locale-depending output encoding is triggered with
393 .Fl T Ns Cm locale .
394 This option is not available on all systems: systems without locale
395 support, or those whose internal representation is not natively UCS-4,
396 will fall back to
397 .Fl T Ns Cm ascii .
398 See
399 .Sx ASCII Output
400 for font style specification and available command-line arguments.
401 .Ss Man Output
402 Translate input format into
403 .Xr man 7
404 output format.
405 This is useful for distributing manual sources to legacy systems
406 lacking
407 .Xr mdoc 7
408 formatters.
409 .Pp
410 If
411 .Xr mdoc 7
412 is passed as input, it is translated into
413 .Xr man 7 .
414 If the input format is
415 .Xr man 7 ,
416 the input is copied to the output, expanding any
417 .Xr roff 7
418 .Sq so
419 requests.
420 The parser is also run, and as usual, the
421 .Fl W
422 level controls which
423 .Sx DIAGNOSTICS
424 are displayed before copying the input to the output.
425 .Ss PDF Output
426 PDF-1.1 output may be generated by
427 .Fl T Ns Cm pdf .
428 See
429 .Sx PostScript Output
430 for
431 .Fl O
432 arguments and defaults.
433 .Ss PostScript Output
434 PostScript
435 .Qq Adobe-3.0
436 Level-2 pages may be generated by
437 .Fl T Ns Cm ps .
438 Output pages default to letter sized and are rendered in the Times font
439 family, 11-point.
440 Margins are calculated as 1/9 the page length and width.
441 Line-height is 1.4m.
442 .Pp
443 Special characters are rendered as in
444 .Sx ASCII Output .
445 .Pp
446 The following
447 .Fl O
448 arguments are accepted:
449 .Bl -tag -width Ds
450 .It Cm paper Ns = Ns Ar name
451 The paper size
452 .Ar name
453 may be one of
454 .Ar a3 ,
455 .Ar a4 ,
456 .Ar a5 ,
457 .Ar legal ,
458 or
459 .Ar letter .
460 You may also manually specify dimensions as
461 .Ar NNxNN ,
462 width by height in millimetres.
463 If an unknown value is encountered,
464 .Ar letter
465 is used.
466 .El
467 .Ss UTF\-8 Output
468 Use
469 .Fl T Ns Cm utf8
470 to force a UTF\-8 locale.
471 See
472 .Sx Locale Output
473 for details and options.
474 .Ss XHTML Output
475 Output produced by
476 .Fl T Ns Cm xhtml
477 conforms to XHTML-1.0 strict.
478 .Pp
479 See
480 .Sx HTML Output
481 for details; beyond generating XHTML tags instead of HTML tags, these
482 output modes are identical.
483 .Sh ENVIRONMENT
484 .Bl -tag -width MANPAGER
485 .It Ev MANPAGER
486 Any non-empty value of the environment variable
487 .Ev MANPAGER
488 will be used instead of the standard pagination program,
489 .Xr more 1 .
490 .It Ev PAGER
491 Specifies the pagination program to use when
492 .Ev MANPAGER
493 is not defined.
494 If neither PAGER nor MANPAGER is defined,
495 .Pa /usr/bin/more Fl s
496 will be used.
497 .El
498 .Sh EXIT STATUS
499 The
500 .Nm
501 utility exits with one of the following values, controlled by the message
502 .Ar level
503 associated with the
504 .Fl W
505 option:
506 .Pp
507 .Bl -tag -width Ds -compact
508 .It 0
509 No warnings or errors occurred, or those that did were ignored because
510 they were lower than the requested
511 .Ar level .
512 .It 2
513 At least one warning occurred, but no error, and
514 .Fl W Ns Cm warning
515 was specified.
516 .It 3
517 At least one parsing error occurred, but no fatal error, and
518 .Fl W Ns Cm error
519 or
520 .Fl W Ns Cm warning
521 was specified.
522 .It 4
523 A fatal parsing error occurred.
524 .It 5
525 Invalid command line arguments were specified.
526 No input files have been read.
527 .It 6
528 An operating system error occurred, for example memory exhaustion or an
529 error accessing input files.
530 Such errors cause
531 .Nm
532 to exit at once, possibly in the middle of parsing or formatting a file.
533 .El
534 .Pp
535 Note that selecting
536 .Fl T Ns Cm lint
537 output mode implies
538 .Fl W Ns Cm warning .
539 .Sh EXAMPLES
540 To page manuals to the terminal:
541 .Pp
542 .Dl $ mandoc \-Wall,stop mandoc.1 2\*(Gt&1 | less
543 .Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
544 .Pp
545 To produce HTML manuals with
546 .Ar style.css
547 as the style-sheet:
548 .Pp
549 .Dl $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
550 .Pp
551 To check over a large set of manuals:
552 .Pp
553 .Dl $ mandoc \-Tlint `find /usr/src -name \e*\e.[1-9]`
554 .Pp
555 To produce a series of PostScript manuals for A4 paper:
556 .Pp
557 .Dl $ mandoc \-Tps \-Opaper=a4 mdoc.7 man.7 \*(Gt manuals.ps
558 .Pp
559 Convert a modern
560 .Xr mdoc 7
561 manual to the older
562 .Xr man 7
563 format, for use on systems lacking an
564 .Xr mdoc 7
565 parser:
566 .Pp
567 .Dl $ mandoc \-Tman foo.mdoc \*(Gt foo.man
568 .Sh DIAGNOSTICS
569 Messages displayed by
570 .Nm
571 follow this format:
572 .Pp
573 .D1 Nm Ns : Ar file : Ns Ar line : Ns Ar column : level : message : macro args
574 .Pp
575 Line and column numbers start at 1.
576 Both are omitted for messages referring to an input file as a whole.
577 Macro names and arguments are omitted where meaningless.
578 Fatal messages about invalid command line arguments
579 or operating system errors, for example when memory is exhausted,
580 may also omit the
581 .Ar file
582 and
583 .Ar level
584 fields.
585 .Pp
586 Message levels have the following meanings:
587 .Bl -tag -width "warning"
588 .It Cm syserr
589 Opening or reading an input file failed, so the parser cannot
590 even be started and no output is produced from that input file.
591 .It Cm fatal
592 The parser is unable to parse a given input file at all.
593 No formatted output is produced from that input file.
594 .It Cm error
595 An input file contains syntax that cannot be safely interpreted,
596 either because it is invalid or because
597 .Nm
598 does not implement it yet.
599 By discarding part of the input or inserting missing tokens,
600 the parser is able to continue, and the error does not prevent
601 generation of formatted output, but typically, preparing that
602 output involves information loss, broken document structure
603 or unintended formatting.
604 .It Cm warning
605 An input file uses obsolete, discouraged or non-portable syntax.
606 All the same, the meaning of the input is unambiguous and a correct
607 rendering can be produced.
608 Documents causing warnings may render poorly when using other
609 formatting tools instead of
610 .Nm .
611 .El
612 .Pp
613 Messages of the
614 .Cm warning
615 and
616 .Cm error
617 levels are hidden unless their level, or a lower level, is requested using a
618 .Fl W
619 option or
620 .Fl T Ns Cm lint
621 output mode.
622 .Ss Warnings related to the document prologue
623 .Bl -ohang
624 .It Sy "missing manual title, using UNTITLED"
625 .Pq mdoc
626 A
627 .Ic \&Dt
628 macro has no arguments, or there is no
629 .Ic \&Dt
630 macro before the first non-prologue macro.
631 .It Sy "missing manual title, using \(dq\(dq"
632 .Pq man
633 There is no
634 .Ic \&TH
635 macro, or it has no arguments.
636 .It Sy "lower case character in document title"
637 .Pq mdoc , man
638 The title is still used as given in the
639 .Ic \&Dt
640 or
641 .Ic \&TH
642 macro.
643 .It Sy "missing manual section, using \(dq\(dq"
644 .Pq mdoc , man
645 A
646 .Ic \&Dt
647 or
648 .Ic \&TH
649 macro lacks the mandatory section argument.
650 .It Sy "unknown manual section"
651 .Pq mdoc
652 The section number in a
653 .Ic \&Dt
654 line is invalid, but still used.
655 .It Sy "unknown manual volume or arch"
656 .Pq mdoc
657 The volume name in a
658 .Ic \&Dt
659 line is invalid, but still used.
660 The manual is assumed to be architecture-independent.
661 .It Sy "missing date, using today's date"
662 .Pq mdoc, man
663 The document was parsed as
664 .Xr mdoc 7
665 and it has no
666 .Ic \&Dd
667 macro, or the
668 .Ic \&Dd
669 macro has no arguments or only empty arguments;
670 or the document was parsed as
671 .Xr man 7
672 and it has no
673 .Ic \&TH
674 macro, or the
675 .Ic \&TH
676 macro has less than three arguments or its third argument is empty.
677 .It Sy "cannot parse date, using it verbatim"
678 .Pq mdoc , man
679 The date given in a
680 .Ic \&Dd
681 or
682 .Ic \&TH
683 macro does not follow the conventional format.
684 .It Sy "missing Os macro, using \(dq\(dq"
685 .Pq mdoc
686 The default or current system is not shown in this case.
687 .It Sy "duplicate prologue macro"
688 .Pq mdoc
689 One of the prologue macros occurs more than once.
690 The last instance overrides all previous ones.
691 .It Sy "late prologue macro"
692 .Pq mdoc
693 A
694 .Ic \&Dd
695 or
696 .Ic \&Os
697 macro occurs after some non-prologue macro, but still takes effect.
698 .It Sy "skipping late title macro"
699 .Pq mdoc
700 The
701 .Ic \&Dt
702 macro can only occur before the first non-prologue macro
703 because traditional formatters write the page header
704 before parsing the document body.
705 Even though this technical restriction does not apply to
706 .Nm ,
707 traditional semantics is preserved.
708 The late macro is discarded including its arguments.
709 .It Sy "prologue macros out of order"
710 .Pq mdoc
711 The prologue macros are not given in the conventional order
712 .Ic \&Dd ,
713 .Ic \&Dt ,
714 .Ic \&Os .
715 All three macros are used even when given in another order.
716 .El
717 .Ss Warnings regarding document structure
718 .Bl -ohang
719 .It Sy ".so is fragile, better use ln(1)"
720 .Pq roff
721 Including files only works when the parser program runs with the correct
722 current working directory.
723 .It Sy "no document body"
724 .Pq mdoc , man
725 The document body contains neither text nor macros.
726 An empty document is shown, consisting only of a header and a footer line.
727 .It Sy "content before first section header"
728 .Pq mdoc , man
729 Some macros or text precede the first
730 .Ic \&Sh
731 or
732 .Ic \&SH
733 section header.
734 The offending macros and text are parsed and added to the top level
735 of the syntax tree, outside any section block.
736 .It Sy "first section is not NAME"
737 .Pq mdoc
738 The argument of the first
739 .Ic \&Sh
740 macro is not
741 .Sq NAME .
742 This may confuse
743 .Xr makewhatis 8
744 and
745 .Xr apropos 1 .
746 .It Sy "bad NAME section contents"
747 .Pq mdoc
748 The last node in the NAME section is not an
749 .Ic \&Nd
750 macro, or any preceding macro is not
751 .Ic \&Nm ,
752 or the NAME section is completely empty.
753 This may confuse
754 .Xr makewhatis 8
755 and
756 .Xr apropos 1 .
757 .It Sy "sections out of conventional order"
758 .Pq mdoc
759 A standard section occurs after another section it usually precedes.
760 All section titles are used as given,
761 and the order of sections is not changed.
762 .It Sy "duplicate section title"
763 .Pq mdoc
764 The same standard section title occurs more than once.
765 .It Sy "unexpected section"
766 .Pq mdoc
767 A standard section header occurs in a section of the manual
768 where it normally isn't useful.
769 .It Sy "AUTHORS section without An macro"
770 .Pq mdoc
771 An AUTHORS sections contains no
772 .Ic \&An
773 macros, or only empty ones.
774 Probably, there are author names lacking markup.
775 .El
776 .Ss "Warnings related to macros and nesting"
777 .Bl -ohang
778 .It Sy "obsolete macro"
779 .Pq mdoc
780 See the
781 .Xr mdoc 7
782 manual for replacements.
783 .It Sy "skipping paragraph macro"
784 In
785 .Xr mdoc 7
786 documents, this happens
787 .Bl -dash -compact
788 .It
789 at the beginning and end of sections and subsections
790 .It
791 right before non-compact lists and displays
792 .It
793 at the end of items in non-column, non-compact lists
794 .It
795 and for multiple consecutive paragraph macros.
796 .El
797 In
798 .Xr man 7
799 documents, it happens
800 .Bl -dash -compact
801 .It
802 for empty
803 .Ic \&P ,
804 .Ic \&PP ,
805 and
806 .Ic \&LP
807 macros
808 .It
809 for
810 .Ic \&IP
811 macros having neither head nor body arguments
812 .It
813 for
814 .Ic \&br
815 or
816 .Ic \&sp
817 right after
818 .Ic \&SH
819 or
820 .Ic \&SS
821 .El
822 .It Sy "moving paragraph macro out of list"
823 .Pq mdoc
824 A list item in a
825 .Ic \&Bl
826 list contains a trailing paragraph macro.
827 The paragraph macro is moved after the end of the list.
828 .It Sy "skipping no-space macro"
829 .Pq mdoc
830 An input line begins with an
831 .Ic \&Ns
832 macro.
833 The macro is ignored.
834 .It Sy "blocks badly nested"
835 .Pq mdoc
836 If two blocks intersect, one should completely contain the other.
837 Otherwise, rendered output is likely to look strange in any output
838 format, and rendering in SGML-based output formats is likely to be
839 outright wrong because such languages do not support badly nested
840 blocks at all.
841 Typical examples of badly nested blocks are
842 .Qq Ic \&Ao \&Bo \&Ac \&Bc
843 and
844 .Qq Ic \&Ao \&Bq \&Ac .
845 In these examples,
846 .Ic \&Ac
847 breaks
848 .Ic \&Bo
849 and
850 .Ic \&Bq ,
851 respectively.
852 .It Sy "nested displays are not portable"
853 .Pq mdoc
854 A
855 .Ic \&Bd ,
856 .Ic \&D1 ,
857 or
858 .Ic \&Dl
859 display occurs nested inside another
860 .Ic \&Bd
861 display.
862 This works with
863 .Nm ,
864 but fails with most other implementations.
865 .It Sy "moving content out of list"
866 .Pq mdoc
867 A
868 .Ic \&Bl
869 list block contains text or macros before the first
870 .Ic \&It
871 macro.
872 The offending children are moved before the beginning of the list.
873 .It Sy ".Vt block has child macro"
874 .Pq mdoc
875 The
876 .Ic \&Vt
877 macro supports plain text arguments only.
878 Formatting may be ugly and semantic searching
879 for the affected content might not work.
880 .It Sy "fill mode already enabled, skipping"
881 .Pq man
882 A
883 .Ic \&fi
884 request occurs even though the document is still in fill mode,
885 or already switched back to fill mode.
886 It has no effect.
887 .It Sy "fill mode already disabled, skipping"
888 .Pq man
889 An
890 .Ic \&nf
891 request occurs even though the document already switched to no-fill mode
892 and did not switch back to fill mode yet.
893 It has no effect.
894 .It Sy "line scope broken"
895 .Pq man
896 While parsing the next-line scope of the previous macro,
897 another macro is found that prematurely terminates the previous one.
898 The previous, interrupted macro is deleted from the parse tree.
899 .El
900 .Ss "Warnings related to missing arguments"
901 .Bl -ohang
902 .It Sy "skipping empty request"
903 .Pq roff
904 The macro name is missing from a macro definition request.
905 .It Sy "conditional request controls empty scope"
906 .Pq roff
907 A conditional request is only useful if any of the following
908 follows it on the same logical input line:
909 .Bl -dash -compact
910 .It
911 The
912 .Sq \e{
913 keyword to open a multi-line scope.
914 .It
915 A request or macro or some text, resulting in a single-line scope.
916 .It
917 The immediate end of the logical line without any intervening whitespace,
918 resulting in next-line scope.
919 .El
920 Here, a conditional request is followed by trailing whitespace only,
921 and there is no other content on its logical input line.
922 Note that it doesn't matter whether the logical input line is split
923 across multiple physical input lines using
924 .Sq \e
925 line continuation characters.
926 This is one of the rare cases
927 where trailing whitespace is syntactically significant.
928 The conditional request controls a scope containing whitespace only,
929 so it is unlikely to have a significant effect,
930 except that it may control a following
931 .Ic \&el
932 clause.
933 .It Sy "skipping empty macro"
934 .Pq mdoc
935 The indicated macro has no arguments and hence no effect.
936 .It Sy "empty argument, using 0n"
937 .Pq mdoc
938 The required width is missing after
939 .Ic \&Bd
940 or
941 .Ic \&Bl
942 .Fl offset
943 or
944 .Fl width.
945 .It Sy "argument count wrong"
946 .Pq mdoc , man
947 The indicated macro has too few or too many arguments.
948 The syntax tree will contain the wrong number of arguments as given.
949 Formatting behaviour depends on the specific macro in question.
950 Note that the same message may also occur as an ERROR, see below.
951 .It Sy "missing display type, using -ragged"
952 .Pq mdoc
953 The
954 .Ic \&Bd
955 macro is invoked without the required display type.
956 .It Sy "list type is not the first argument"
957 .Pq mdoc
958 In a
959 .Ic \&Bl
960 macro, at least one other argument precedes the type argument.
961 The
962 .Nm
963 utility copes with any argument order, but some other
964 .Xr mdoc 7
965 implementations do not.
966 .It Sy "missing -width in -tag list, using 8n"
967 .Pq mdoc
968 Every
969 .Ic \&Bl
970 macro having the
971 .Fl tag
972 argument requires
973 .Fl width ,
974 too.
975 .It Sy "missing utility name, using \(dq\(dq"
976 .Pq mdoc
977 The
978 .Ic \&Ex Fl std
979 macro is called without an argument before
980 .Ic \&Nm
981 has first been called with an argument.
982 .It Sy "empty head in list item"
983 .Pq mdoc
984 In a
985 .Ic \&Bl
986 .Fl diag ,
987 .Fl hang ,
988 .Fl inset ,
989 .Fl ohang ,
990 or
991 .Fl tag
992 list, an
993 .Ic \&It
994 macro lacks the required argument.
995 The item head is left empty.
996 .It Sy "empty list item"
997 .Pq mdoc
998 In a
999 .Ic \&Bl
1000 .Fl bullet ,
1001 .Fl dash ,
1002 .Fl enum ,
1003 or
1004 .Fl hyphen
1005 list, an
1006 .Ic \&It
1007 block is empty.
1008 An empty list item is shown.
1009 .It Sy "missing font type"
1010 .Pq mdoc
1011 A
1012 .Ic \&Bf
1013 macro has no argument.
1014 It switches to the default font,
1015 .Cm \efR .
1016 .It Sy "unknown font type"
1017 .Pq mdoc
1018 The
1019 .Ic \&Bf
1020 argument is invalid.
1021 The default font
1022 .Cm \efR
1023 is used instead.
1024 .It Sy "missing -std argument, adding it"
1025 .Pq mdoc
1026 An
1027 .Ic \&Ex
1028 or
1029 .Ic \&Rv
1030 macro lacks the required
1031 .Fl std
1032 argument.
1033 The
1034 .Nm
1035 utility assumes
1036 .Fl std
1037 even when it is not specified, but other implementations may not.
1038 .El
1039 .Ss "Warnings related to bad macro arguments"
1040 .Bl -ohang
1041 .It Sy "unterminated quoted argument"
1042 .Pq roff
1043 Macro arguments can be enclosed in double quote characters
1044 such that space characters and macro names contained in the quoted
1045 argument need not be escaped.
1046 The closing quote of the last argument of a macro can be omitted.
1047 However, omitting it is not recommended because it makes the code
1048 harder to read.
1049 .It Sy "duplicate argument"
1050 .Pq mdoc
1051 A
1052 .Ic \&Bd
1053 or
1054 .Ic \&Bl
1055 macro has more than one
1056 .Fl compact ,
1057 more than one
1058 .Fl offset ,
1059 or more than one
1060 .Fl width
1061 argument.
1062 All but the last instances of these arguments are ignored.
1063 .It Sy "skipping duplicate argument"
1064 .Pq mdoc
1065 An
1066 .Ic \&An
1067 macro has more than one
1068 .Fl split
1069 or
1070 .Fl nosplit
1071 argument.
1072 All but the first of these arguments are ignored.
1073 .It Sy "skipping duplicate display type"
1074 .Pq mdoc
1075 A
1076 .Ic \&Bd
1077 macro has more than one type argument; the first one is used.
1078 .It Sy "skipping duplicate list type"
1079 .Pq mdoc
1080 A
1081 .Ic \&Bl
1082 macro has more than one type argument; the first one is used.
1083 .It Sy "skipping -width argument"
1084 .Pq mdoc
1085 A
1086 .Ic \&Bl
1087 .Fl column ,
1088 .Fl diag ,
1089 .Fl ohang ,
1090 .Fl inset ,
1091 or
1092 .Fl item
1093 list has a
1094 .Fl width
1095 argument.
1096 That has no effect.
1097 .It Sy "unknown AT&T UNIX version"
1098 .Pq mdoc
1099 An
1100 .Ic \&At
1101 macro has an invalid argument.
1102 It is used verbatim, with
1103 .Qq "AT&T UNIX "
1104 prefixed to it.
1105 .It Sy "invalid content in Rs block"
1106 .Pq mdoc
1107 An
1108 .Ic \&Rs
1109 block contains plain text or non-% macros.
1110 The bogus content is left in the syntax tree.
1111 Formatting may be poor.
1112 .It Sy "invalid Boolean argument"
1113 .Pq mdoc
1114 An
1115 .Ic \&Sm
1116 macro has an argument other than
1117 .Cm on
1118 or
1119 .Cm off .
1120 The invalid argument is moved out of the macro, which leaves the macro
1121 empty, causing it to toggle the spacing mode.
1122 .It Sy "unknown font, skipping request"
1123 .Pq man
1124 A
1125 .Xr roff 7
1126 .Ic \&ft
1127 request has an invalid argument.
1128 .El
1129 .Ss "Warnings related to plain text"
1130 .Bl -ohang
1131 .It Sy "blank line in fill mode, using .sp"
1132 .Pq mdoc
1133 The meaning of blank input lines is only well-defined in non-fill mode:
1134 In fill mode, line breaks of text input lines are not supposed to be
1135 significant.
1136 However, for compatibility with groff, blank lines in fill mode
1137 are replaced with
1138 .Ic \&sp
1139 requests.
1140 .It Sy "tab in filled text"
1141 .Pq mdoc , man
1142 The meaning of tab characters is only well-defined in non-fill mode:
1143 In fill mode, whitespace is not supposed to be significant
1144 on text input lines.
1145 As an implementation dependent choice, tab characters on text lines
1146 are passed through to the formatters in any case.
1147 Given that the text before the tab character will be filled,
1148 it is hard to predict which tab stop position the tab will advance to.
1149 .It Sy "whitespace at end of input line"
1150 .Pq mdoc , man , roff
1151 Whitespace at the end of input lines is almost never semantically
1152 significant \(em but in the odd case where it might be, it is
1153 extremely confusing when reviewing and maintaining documents.
1154 .It Sy "bad comment style"
1155 .Pq roff
1156 Comment lines start with a dot, a backslash, and a double-quote character.
1157 The
1158 .Nm
1159 utility treats the line as a comment line even without the backslash,
1160 but leaving out the backslash might not be portable.
1161 .It Sy "invalid escape sequence"
1162 .Pq roff
1163 An escape sequence has an invalid opening argument delimiter, lacks the
1164 closing argument delimiter, or the argument has too few characters.
1165 If the argument is incomplete,
1166 .Ic \e*
1167 and
1168 .Ic \en
1169 expand to an empty string,
1170 .Ic \eB
1171 to the digit
1172 .Sq 0 ,
1173 and
1174 .Ic \ew
1175 to the length of the incomplete argument.
1176 All other invalid escape sequences are ignored.
1177 .It Sy "undefined string, using \(dq\(dq"
1178 .Pq roff
1179 If a string is used without being defined before,
1180 its value is implicitly set to the empty string.
1181 However, defining strings explicitly before use
1182 keeps the code more readable.
1183 .El
1184 .Ss "Errors related to equations"
1185 .Bl -inset -compact
1186 .It "unexpected equation scope closure"
1187 .It "equation scope open on exit"
1188 .It "overlapping equation scopes"
1189 .It "unexpected end of equation"
1190 .It "equation syntax error"
1191 .El
1192 .Ss "Errors related to tables"
1193 .Bl -inset -compact
1194 .It "bad table syntax"
1195 .It "bad table option"
1196 .It "bad table layout"
1197 .It "no table layout cells specified"
1198 .It "no table data cells specified"
1199 .It "ignore data in cell"
1200 .It "data block still open"
1201 .It "ignoring extra data cells"
1202 .El
1203 .Ss "Errors related to roff, mdoc, and man code"
1204 .Bl -ohang
1205 .It Sy "input stack limit exceeded, infinite loop?"
1206 .Pq roff
1207 Explicit recursion limits are implemented for the following features,
1208 in order to prevent infinite loops:
1209 .Bl -dash -compact
1210 .It
1211 expansion of nested escape sequences
1212 including expansion of strings and number registers,
1213 .It
1214 expansion of nested user-defined macros,
1215 .It
1216 and
1217 .Ic \&so
1218 file inclusion.
1219 .El
1220 When a limit is hit, the output is incorrect, typically losing
1221 some content, but the parser can continue.
1222 .It Sy "skipping bad character"
1223 .Pq mdoc , man , roff
1224 The input file contains a byte that is not a printable
1225 .Xr ascii 7
1226 character.
1227 The message mentions the character number.
1228 The offending byte is replaced with a question mark
1229 .Pq Sq \&? .
1230 Consider editing the input file to replace the byte with an ASCII
1231 transliteration of the intended character.
1232 .It Sy "skipping unknown macro"
1233 .Pq mdoc , man , roff
1234 The first identifier on a request or macro line is neither recognized as a
1235 .Xr roff 7
1236 request, nor as a user-defined macro, nor, respectively, as an
1237 .Xr mdoc 7
1238 or
1239 .Xr man 7
1240 macro.
1241 It may be mistyped or unsupported.
1242 The request or macro is discarded including its arguments.
1243 .It Sy "skipping item outside list"
1244 .Pq mdoc
1245 An
1246 .Ic \&It
1247 macro occurs outside any
1248 .Ic \&Bl
1249 list.
1250 It is discarded including its arguments.
1251 .It Sy "skipping column outside column list"
1252 .Pq mdoc
1253 A
1254 .Ic \&Ta
1255 macro occurs outside any
1256 .Ic \&Bl Fl column
1257 block.
1258 It is discarded including its arguments.
1259 .It Sy "skipping end of block that is not open"
1260 .Pq mdoc , man , eqn , tbl , roff
1261 Various syntax elements can only be used to explicitly close blocks
1262 that have previously been opened.
1263 An
1264 .Xr mdoc 7
1265 block closing macro, a
1266 .Xr man 7
1267 .Ic \&RE
1268 or
1269 .Ic \&UE
1270 macro, or the end of an equation, table, or
1271 .Xr roff 7
1272 conditional request is encountered but no matching block is open.
1273 The offending request or macro is discarded.
1274 .It Sy "inserting missing end of block"
1275 .Pq mdoc , tbl
1276 Various
1277 .Xr mdoc 7
1278 macros as well as tables require explicit closing by dedicated macros.
1279 A block that doesn't support bad nesting
1280 ends before all of its children are properly closed.
1281 The open child nodes are closed implicitly.
1282 .It Sy "scope open on exit"
1283 .Pq mdoc , man , eqn , tbl , roff
1284 At the end of the document, an explicit
1285 .Xr mdoc 7
1286 block, a
1287 .Xr man 7
1288 next-line scope or
1289 .Ic \&RS
1290 or
1291 .Ic \&UR
1292 block, an equation, table, or
1293 .Xr roff 7
1294 conditional or ignore block is still open.
1295 The open block is closed implicitly.
1296 .It Sy "escaped character not allowed in a name"
1297 .Pq roff
1298 Macro, string and register identifiers consist of printable,
1299 non-whitespace ASCII characters.
1300 Escape sequences and characters and strings expressed in terms of them
1301 cannot form part of a name.
1302 The first argument of an
1303 .Ic \&am ,
1304 .Ic \&as ,
1305 .Ic \&de ,
1306 .Ic \&ds ,
1307 .Ic \&nr ,
1308 or
1309 .Ic \&rr
1310 request, or any argument of an
1311 .Ic \&rm
1312 request, or the name of a request or user defined macro being called,
1313 is terminated by an escape sequence.
1314 In the cases of
1315 .Ic \&as ,
1316 .Ic \&ds ,
1317 and
1318 .Ic \&nr ,
1319 the request has no effect at all.
1320 In the cases of
1321 .Ic \&am ,
1322 .Ic \&de ,
1323 .Ic \&rr ,
1324 and
1325 .Ic \&rm ,
1326 what was parsed up to this point is used as the arguments to the request,
1327 and the rest of the input line is discarded including the escape sequence.
1328 When parsing for a request or a user-defined macro name to be called,
1329 only the escape sequence is discarded.
1330 The characters preceding it are used as the request or macro name,
1331 the characters following it are used as the arguments to the request or macro.
1332 .It Sy "argument count wrong"
1333 .Pq mdoc , man , roff
1334 The indicated request or macro has too few or too many arguments.
1335 The syntax tree will contain the wrong number of arguments as given.
1336 Formatting behaviour depends on the specific request or macro in question.
1337 Note that the same message may also occur as a WARNING, see above.
1338 .It Sy "missing list type, using -item"
1339 .Pq mdoc
1340 A
1341 .Ic \&Bl
1342 macro fails to specify the list type.
1343 .It Sy "missing manual name, using \(dq\(dq"
1344 .Pq mdoc
1345 The first call to
1346 .Ic \&Nm
1347 lacks the required argument.
1348 .It Sy "uname(3) system call failed, using UNKNOWN"
1349 .Pq mdoc
1350 The
1351 .Ic \&Os
1352 macro is called without arguments, and the
1353 .Xr uname 3
1354 system call failed.
1355 As a workaround,
1356 .Nm
1357 can be compiled with
1358 .Sm off
1359 .Fl D Cm OSNAME=\(dq\e\(dq Ar string Cm \e\(dq\(dq .
1360 .Sm on
1361 .It Sy "unknown standard specifier"
1362 .Pq mdoc
1363 An
1364 .Ic \&St
1365 macro has an unknown argument and is discarded.
1366 .It Sy "skipping request without numeric argument"
1367 .Pq roff
1368 An
1369 .Ic \&it
1370 request has a non-numeric or negative argument or no argument at all.
1371 The invalid request is ignored.
1372 .It Sy "skipping all arguments"
1373 .Pq mdoc , man , eqn , roff
1374 An
1375 .Xr mdoc 7
1376 .Ic \&Bt ,
1377 .Ic \&Ed ,
1378 .Ic \&Ef ,
1379 .Ic \&Ek ,
1380 .Ic \&El ,
1381 .Ic \&Re ,
1382 or
1383 .Ic \&Ud
1384 macro, an
1385 .Ic \&It
1386 macro in a list that don't support item heads, a
1387 .Xr man 7
1388 .Ic \&LP ,
1389 .Ic \&P ,
1390 or
1391 .Ic \&PP
1392 macro, an
1393 .Xr eqn 7
1394 .Ic \&EN
1395 macro, or a
1396 .Xr roff 7
1397 .Sq \&..
1398 block closing request is invoked with at least one argument.
1399 All arguments are ignored.
1400 .It Sy "skipping excess arguments"
1401 .Pq mdoc , roff
1402 The
1403 .Ic \&Bf
1404 macro is invoked with more than one argument, or a request of the
1405 .Ic \&de
1406 family is invoked with more than two arguments.
1407 The excess arguments are ignored.
1408 .El
1409 .Ss FATAL errors
1410 .Bl -ohang
1411 .It Sy "input too large"
1412 .Pq mdoc , man
1413 Currently,
1414 .Nm
1415 cannot handle input files larger than its arbitrary size limit
1416 of 2^31 bytes (2 Gigabytes).
1417 Since useful manuals are always small, this is not a problem in practice.
1418 Parsing is aborted as soon as the condition is detected.
1419 .It Sy "NOT IMPLEMENTED: Bd -file"
1420 .Pq mdoc
1421 For security reasons, the
1422 .Ic \&Bd
1423 macro does not support the
1424 .Fl file
1425 argument.
1426 By requesting the inclusion of a sensitive file, a malicious document
1427 might otherwise trick a privileged user into inadvertently displaying
1428 the file on the screen, revealing the file content to bystanders.
1429 The parser exits immediately.
1430 .It Sy "NOT IMPLEMENTED: .so with absolute path or \(dq..\(dq"
1431 .Pq roff
1432 For security reasons,
1433 .Nm
1434 allows
1435 .Ic \&so
1436 file inclusion requests only with relative paths
1437 and only without ascending to any parent directory.
1438 By requesting the inclusion of a sensitive file, a malicious document
1439 might otherwise trick a privileged user into inadvertently displaying
1440 the file on the screen, revealing the file content to bystanders.
1441 The parser exits immediately.
1442 .It Sy ".so request failed"
1443 .Pq roff
1444 Servicing a
1445 .Ic \&so
1446 request requires reading an external file.
1447 While trying to do so, an
1448 .Xr open 2 ,
1449 .Xr stat 2 ,
1450 or
1451 .Xr read 2
1452 system call failed.
1453 The parser exits immediately.
1454 Before showing this message,
1455 .Nm
1456 always shows another message explaining why the system call failed.
1457 .El
1458 .Sh COMPATIBILITY
1459 This section summarises
1460 .Nm
1461 compatibility with GNU troff.
1462 Each input and output format is separately noted.
1463 .Ss ASCII Compatibility
1464 .Bl -bullet -compact
1465 .It
1466 Unrenderable unicode codepoints specified with
1467 .Sq \e[uNNNN]
1468 escapes are printed as
1469 .Sq \&?
1470 in mandoc.
1471 In GNU troff, these raise an error.
1472 .It
1473 The
1474 .Sq \&Bd \-literal
1475 and
1476 .Sq \&Bd \-unfilled
1477 macros of
1478 .Xr mdoc 7
1479 in
1480 .Fl T Ns Cm ascii
1481 are synonyms, as are \-filled and \-ragged.
1482 .It
1483 In historic GNU troff, the
1484 .Sq \&Pa
1485 .Xr mdoc 7
1486 macro does not underline when scoped under an
1487 .Sq \&It
1488 in the FILES section.
1489 This behaves correctly in
1490 .Nm .
1491 .It
1492 A list or display following the
1493 .Sq \&Ss
1494 .Xr mdoc 7
1495 macro in
1496 .Fl T Ns Cm ascii
1497 does not assert a prior vertical break, just as it doesn't with
1498 .Sq \&Sh .
1499 .It
1500 The
1501 .Sq \&na
1502 .Xr man 7
1503 macro in
1504 .Fl T Ns Cm ascii
1505 has no effect.
1506 .It
1507 Words aren't hyphenated.
1508 .El
1509 .Ss HTML/XHTML Compatibility
1510 .Bl -bullet -compact
1511 .It
1512 The
1513 .Sq \efP
1514 escape will revert the font to the previous
1515 .Sq \ef
1516 escape, not to the last rendered decoration, which is now dictated by
1517 CSS instead of hard-coded.
1518 It also will not span past the current scope,
1519 for the same reason.
1520 Note that in
1521 .Sx ASCII Output
1522 mode, this will work fine.
1523 .It
1524 The
1525 .Xr mdoc 7
1526 .Sq \&Bl \-hang
1527 and
1528 .Sq \&Bl \-tag
1529 list types render similarly (no break following overreached left-hand
1530 side) due to the expressive constraints of HTML.
1531 .It
1532 The
1533 .Xr man 7
1534 .Sq IP
1535 and
1536 .Sq TP
1537 lists render similarly.
1538 .El
1539 .Sh SEE ALSO
1540 .Xr eqn 7 ,
1541 .Xr man 7 ,
1542 .Xr mandoc_char 7 ,
1543 .Xr mdoc 7 ,
1544 .Xr roff 7 ,
1545 .Xr tbl 7
1546 .Sh AUTHORS
1547 The
1548 .Nm
1549 utility was written by
1550 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
1551 .Sh CAVEATS
1552 In
1553 .Fl T Ns Cm html
1554 and
1555 .Fl T Ns Cm xhtml ,
1556 the maximum size of an element attribute is determined by
1557 .Dv BUFSIZ ,
1558 which is usually 1024 bytes.
1559 Be aware of this when setting long link
1560 formats such as
1561 .Fl O Ns Cm style Ns = Ns Ar really/long/link .
1562 .Pp
1563 Nesting elements within next-line element scopes of
1564 .Fl m Ns Cm an ,
1565 such as
1566 .Sq br
1567 within an empty
1568 .Sq B ,
1569 will confuse
1570 .Fl T Ns Cm html
1571 and
1572 .Fl T Ns Cm xhtml
1573 and cause them to forget the formatting of the prior next-line scope.
1574 .Pp
1575 The
1576 .Sq \(aq
1577 control character is an alias for the standard macro control character
1578 and does not emit a line-break as stipulated in GNU troff.