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