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