xref: /openbsd-src/usr.bin/mandoc/mandoc.1 (revision 3374c67d44f9b75b98444cbf63020f777792342e)
1.\" $OpenBSD: mandoc.1,v 1.190 2022/12/22 19:53:23 kn 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: December 22 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 argument ...
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 arguments are omitted where meaningless.
789The
790.Ar os
791operating system specifier is omitted for messages that are relevant
792for all operating systems.
793Fatal messages about invalid command line arguments
794or operating system errors, for example when memory is exhausted,
795may also omit the
796.Ar file
797and
798.Ar level
799fields.
800.Pp
801Message levels have the following meanings:
802.Bl -tag -width "warning"
803.It Cm syserr
804An operating system error occurred.
805There isn't necessarily anything wrong with the input files.
806Output may all the same be missing or incomplete.
807.It Cm badarg
808Invalid command line arguments were specified.
809No input files have been read and no output is produced.
810.It Cm unsupp
811An input file uses unsupported low-level
812.Xr roff 7
813features.
814The output may be incomplete and/or misformatted,
815so using GNU troff instead of
816.Nm
817to process the file may be preferable.
818.It Cm error
819Indicates a risk of information loss or severe misformatting,
820in most cases caused by serious syntax errors.
821.It Cm warning
822Indicates a risk that the information shown or its formatting
823may mismatch the author's intent in minor ways.
824Additionally, syntax errors are classified at least as warnings,
825even if they do not usually cause misformatting.
826.It Cm style
827An input file uses dubious or discouraged style.
828This is not a complaint about the syntax, and probably neither
829formatting nor portability are in danger.
830While great care is taken to avoid false positives on the higher
831message levels, the
832.Cm style
833level tries to reduce the probability that issues go unnoticed,
834so it may occasionally issue bogus suggestions.
835Use your judgement to decide whether any particular
836.Cm style
837suggestion really justifies a change to the input file.
838.It Cm base
839A convention used in the base system of a specific operating system
840is not adhered to.
841These are not markup mistakes, and neither the quality of formatting
842nor portability are in danger.
843Messages of the
844.Cm base
845level are printed with the more intuitive
846.Cm style
847.Ar level
848tag.
849.El
850.Pp
851Messages of the
852.Cm base ,
853.Cm style ,
854.Cm warning ,
855.Cm error ,
856and
857.Cm unsupp
858levels are hidden unless their level, or a lower level, is requested using a
859.Fl W
860option or
861.Fl T Cm lint
862output mode.
863.Pp
864As indicated below, all
865.Cm base
866and some
867.Cm style
868checks are only performed if a specific operating system name occurs
869in the arguments of the
870.Fl W
871command line option, of the
872.Ic \&Os
873macro, of the
874.Fl Ios
875command line option, or, if neither are present, in the return value
876of the
877.Xr uname 3
878function.
879.Ss Conventions for base system manuals
880.Bl -ohang
881.It Sy "Mdocdate found"
882.Pq mdoc , Nx
883The
884.Ic \&Dd
885macro uses CVS
886.Ic Mdocdate
887keyword substitution, which is not supported by the
888.Nx
889base system.
890Consider using the conventional
891.Dq "Month dd, yyyy"
892format instead.
893.It Sy "Mdocdate missing"
894.Pq mdoc , Ox
895The
896.Ic \&Dd
897macro does not use CVS
898.Ic Mdocdate
899keyword substitution, but using it is conventionally expected in the
900.Ox
901base system.
902.It Sy "unknown architecture"
903.Pq mdoc , Ox , Nx
904The third argument of the
905.Ic \&Dt
906macro does not match any of the architectures this operating system
907is running on.
908.It Sy "operating system explicitly specified"
909.Pq mdoc , Ox , Nx
910The
911.Ic \&Os
912macro has an argument.
913In the base system, it is conventionally left blank.
914.It Sy "RCS id missing"
915.Pq Ox , Nx
916The manual page lacks the comment line with the RCS identifier
917generated by CVS
918.Ic OpenBSD
919or
920.Ic NetBSD
921keyword substitution as conventionally used in these operating systems.
922.El
923.Ss Style suggestions
924.Bl -ohang
925.It Sy "legacy man(7) date format"
926.Pq mdoc
927The
928.Ic \&Dd
929macro uses the legacy
930.Xr man 7
931date format
932.Dq yyyy-dd-mm .
933Consider using the conventional
934.Xr mdoc 7
935date format
936.Dq "Month dd, yyyy"
937instead.
938.It Sy "normalizing date format to" : No ...
939.Pq mdoc , man
940The
941.Ic \&Dd
942or
943.Ic \&TH
944macro provides an abbreviated month name or a day number with a
945leading zero.
946In the formatted output, the month name is written out in full
947and the leading zero is omitted.
948.It Sy "lower case character in document title"
949.Pq mdoc , man
950The title is still used as given in the
951.Ic \&Dt
952or
953.Ic \&TH
954macro.
955.It Sy "duplicate RCS id"
956A single manual page contains two copies of the RCS identifier for
957the same operating system.
958Consider deleting the later instance and moving the first one up
959to the top of the page.
960.It Sy "possible typo in section name"
961.Pq mdoc
962Fuzzy string matching revealed that the argument of an
963.Ic \&Sh
964macro is similar, but not identical to a standard section name.
965.It Sy "unterminated quoted argument"
966.Pq roff
967Macro arguments can be enclosed in double quote characters
968such that space characters and macro names contained in the quoted
969argument need not be escaped.
970The closing quote of the last argument of a macro can be omitted.
971However, omitting it is not recommended because it makes the code
972harder to read.
973.It Sy "useless macro"
974.Pq mdoc
975A
976.Ic \&Bt ,
977.Ic \&Tn ,
978or
979.Ic \&Ud
980macro was found.
981Simply delete it: it serves no useful purpose.
982.It Sy "consider using OS macro"
983.Pq mdoc
984A string was found in plain text or in a
985.Ic \&Bx
986macro that could be represented using
987.Ic \&Ox ,
988.Ic \&Nx ,
989.Ic \&Fx ,
990or
991.Ic \&Dx .
992.It Sy "errnos out of order"
993.Pq mdoc, Nx
994The
995.Ic \&Er
996items in a
997.Ic \&Bl
998list are not in alphabetical order.
999.It Sy "duplicate errno"
1000.Pq mdoc, Nx
1001A
1002.Ic \&Bl
1003list contains two consecutive
1004.Ic \&It
1005entries describing the same
1006.Ic \&Er
1007number.
1008.It Sy "referenced manual not found"
1009.Pq mdoc
1010An
1011.Ic \&Xr
1012macro references a manual page that was not found.
1013When running with
1014.Fl W Cm base ,
1015the search is restricted to the base system, by default to
1016.Pa /usr/share/man : Ns Pa /usr/X11R6/man .
1017This path can be configured at compile time using the
1018.Dv MANPATH_BASE
1019preprocessor macro.
1020When running with
1021.Fl W Cm style ,
1022the search is done along the full search path as described in the
1023.Xr man 1
1024manual page, respecting the
1025.Fl m
1026and
1027.Fl M
1028command line options, the
1029.Ev MANPATH
1030environment variable, the
1031.Xr man.conf 5
1032file and falling back to the default of
1033.Pa /usr/share/man : Ns Pa /usr/X11R6/man : Ns Pa /usr/local/man ,
1034also configurable at compile time using the
1035.Dv MANPATH_DEFAULT
1036preprocessor macro.
1037.It Sy "trailing delimiter"
1038.Pq mdoc
1039The last argument of an
1040.Ic \&Ex , \&Fo , \&Nd , \&Nm , \&Os , \&Sh , \&Ss , \&St ,
1041or
1042.Ic \&Sx
1043macro ends with a trailing delimiter.
1044This is usually bad style and often indicates typos.
1045Most likely, the delimiter can be removed.
1046.It Sy "no blank before trailing delimiter"
1047.Pq mdoc
1048The last argument of a macro that supports trailing delimiter
1049arguments is longer than one byte and ends with a trailing delimiter.
1050Consider inserting a blank such that the delimiter becomes a separate
1051argument, thus moving it out of the scope of the macro.
1052.It Sy "fill mode already enabled, skipping"
1053.Pq man
1054A
1055.Ic \&fi
1056request occurs even though the document is still in fill mode,
1057or already switched back to fill mode.
1058It has no effect.
1059.It Sy "fill mode already disabled, skipping"
1060.Pq man
1061An
1062.Ic \&nf
1063request occurs even though the document already switched to no-fill mode
1064and did not switch back to fill mode yet.
1065It has no effect.
1066.It Sy "input text line longer than 80 bytes"
1067Consider breaking the input text line
1068at one of the blank characters before column 80.
1069.It Sy "verbatim \(dq--\(dq, maybe consider using \e(em"
1070.Pq mdoc
1071Even though the ASCII output device renders an em-dash as
1072.Qq \-\- ,
1073that is not a good way to write it in an input file
1074because it renders poorly on all other output devices.
1075.It Sy "function name without markup"
1076.Pq mdoc
1077A word followed by an empty pair of parentheses occurs on a text line.
1078Consider using an
1079.Ic \&Fn
1080or
1081.Ic \&Xr
1082macro.
1083.It Sy "whitespace at end of input line"
1084.Pq mdoc , man , roff
1085Whitespace at the end of input lines is almost never semantically
1086significant \(em but in the odd case where it might be, it is
1087extremely confusing when reviewing and maintaining documents.
1088.It Sy "bad comment style"
1089.Pq roff
1090Comment lines start with a dot, a backslash, and a double-quote character.
1091The
1092.Nm
1093utility treats the line as a comment line even without the backslash,
1094but leaving out the backslash might not be portable.
1095.El
1096.Ss Warnings related to the document prologue
1097.Bl -ohang
1098.It Sy "missing manual title, using UNTITLED"
1099.Pq mdoc
1100A
1101.Ic \&Dt
1102macro has no arguments, or there is no
1103.Ic \&Dt
1104macro before the first non-prologue macro.
1105.It Sy "missing manual title, using \(dq\(dq"
1106.Pq man
1107There is no
1108.Ic \&TH
1109macro, or it has no arguments.
1110.It Sy "missing manual section, using \(dq\(dq"
1111.Pq mdoc , man
1112A
1113.Ic \&Dt
1114or
1115.Ic \&TH
1116macro lacks the mandatory section argument.
1117.It Sy "unknown manual section"
1118.Pq mdoc
1119The section number in a
1120.Ic \&Dt
1121line is invalid, but still used.
1122.It Sy "filename/section mismatch"
1123.Pq mdoc , man
1124The name of the input file being processed is known and its file
1125name extension starts with a non-zero digit, but the
1126.Ic \&Dt
1127or
1128.Ic \&TH
1129macro contains a
1130.Ar section
1131argument that starts with a different non-zero digit.
1132The
1133.Ar section
1134argument is used as provided anyway.
1135Consider checking whether the file name or the argument need a correction.
1136.It Sy "missing date, using \(dq\(dq"
1137.Pq mdoc, man
1138The document was parsed as
1139.Xr mdoc 7
1140and it has no
1141.Ic \&Dd
1142macro, or the
1143.Ic \&Dd
1144macro has no arguments or only empty arguments;
1145or the document was parsed as
1146.Xr man 7
1147and it has no
1148.Ic \&TH
1149macro, or the
1150.Ic \&TH
1151macro has less than three arguments or its third argument is empty.
1152.It Sy "cannot parse date, using it verbatim"
1153.Pq mdoc , man
1154The date given in a
1155.Ic \&Dd
1156or
1157.Ic \&TH
1158macro does not follow the conventional format.
1159.It Sy "date in the future, using it anyway"
1160.Pq mdoc , man
1161The date given in a
1162.Ic \&Dd
1163or
1164.Ic \&TH
1165macro is more than a day ahead of the current system
1166.Xr time 3 .
1167.It Sy "missing Os macro, using \(dq\(dq"
1168.Pq mdoc
1169The default or current system is not shown in this case.
1170.It Sy "late prologue macro"
1171.Pq mdoc
1172A
1173.Ic \&Dd
1174or
1175.Ic \&Os
1176macro occurs after some non-prologue macro, but still takes effect.
1177.It Sy "prologue macros out of order"
1178.Pq mdoc
1179The prologue macros are not given in the conventional order
1180.Ic \&Dd ,
1181.Ic \&Dt ,
1182.Ic \&Os .
1183All three macros are used even when given in another order.
1184.El
1185.Ss Warnings regarding document structure
1186.Bl -ohang
1187.It Sy ".so is fragile, better use ln(1)"
1188.Pq roff
1189Including files only works when the parser program runs with the correct
1190current working directory.
1191.It Sy "no document body"
1192.Pq mdoc , man
1193The document body contains neither text nor macros.
1194An empty document is shown, consisting only of a header and a footer line.
1195.It Sy "content before first section header"
1196.Pq mdoc , man
1197Some macros or text precede the first
1198.Ic \&Sh
1199or
1200.Ic \&SH
1201section header.
1202The offending macros and text are parsed and added to the top level
1203of the syntax tree, outside any section block.
1204.It Sy "first section is not NAME"
1205.Pq mdoc
1206The argument of the first
1207.Ic \&Sh
1208macro is not
1209.Sq NAME .
1210This may confuse
1211.Xr makewhatis 8
1212and
1213.Xr apropos 1 .
1214.It Sy "NAME section without Nm before Nd"
1215.Pq mdoc
1216The NAME section does not contain any
1217.Ic \&Nm
1218child macro before the first
1219.Ic \&Nd
1220macro.
1221.It Sy "NAME section without description"
1222.Pq mdoc
1223The NAME section lacks the mandatory
1224.Ic \&Nd
1225child macro.
1226.It Sy "description not at the end of NAME"
1227.Pq mdoc
1228The NAME section does contain an
1229.Ic \&Nd
1230child macro, but other content follows it.
1231.It Sy "bad NAME section content"
1232.Pq mdoc
1233The NAME section contains plain text or macros other than
1234.Ic \&Nm
1235and
1236.Ic \&Nd .
1237.It Sy "missing comma before name"
1238.Pq mdoc
1239The NAME section contains an
1240.Ic \&Nm
1241macro that is neither the first one nor preceded by a comma.
1242.It Sy "missing description line, using \(dq\(dq"
1243.Pq mdoc
1244The
1245.Ic \&Nd
1246macro lacks the required argument.
1247The title line of the manual will end after the dash.
1248.It Sy "description line outside NAME section"
1249.Pq mdoc
1250An
1251.Ic \&Nd
1252macro appears outside the NAME section.
1253The arguments are printed anyway and the following text is used for
1254.Xr apropos 1 ,
1255but none of that behaviour is portable.
1256.It Sy "sections out of conventional order"
1257.Pq mdoc
1258A standard section occurs after another section it usually precedes.
1259All section titles are used as given,
1260and the order of sections is not changed.
1261.It Sy "duplicate section title"
1262.Pq mdoc
1263The same standard section title occurs more than once.
1264.It Sy "unexpected section"
1265.Pq mdoc
1266A standard section header occurs in a section of the manual
1267where it normally isn't useful.
1268.It Sy "cross reference to self"
1269.Pq mdoc
1270An
1271.Ic \&Xr
1272macro refers to a name and section matching the section of the present
1273manual page and a name mentioned in an
1274.Ic \&Nm
1275macro in the NAME or SYNOPSIS section, or in an
1276.Ic \&Fn
1277or
1278.Ic \&Fo
1279macro in the SYNOPSIS.
1280Consider using
1281.Ic \&Nm
1282or
1283.Ic \&Fn
1284instead of
1285.Ic \&Xr .
1286.It Sy "unusual Xr order"
1287.Pq mdoc
1288In the SEE ALSO section, an
1289.Ic \&Xr
1290macro with a lower section number follows one with a higher number,
1291or two
1292.Ic \&Xr
1293macros referring to the same section are out of alphabetical order.
1294.It Sy "unusual Xr punctuation"
1295.Pq mdoc
1296In the SEE ALSO section, punctuation between two
1297.Ic \&Xr
1298macros differs from a single comma, or there is trailing punctuation
1299after the last
1300.Ic \&Xr
1301macro.
1302.It Sy "AUTHORS section without An macro"
1303.Pq mdoc
1304An AUTHORS sections contains no
1305.Ic \&An
1306macros, or only empty ones.
1307Probably, there are author names lacking markup.
1308.El
1309.Ss "Warnings related to macros and nesting"
1310.Bl -ohang
1311.It Sy "obsolete macro"
1312.Pq mdoc
1313See the
1314.Xr mdoc 7
1315manual for replacements.
1316.It Sy "macro neither callable nor escaped"
1317.Pq mdoc
1318The name of a macro that is not callable appears on a macro line.
1319It is printed verbatim.
1320If the intention is to call it, move it to its own input line;
1321otherwise, escape it by prepending
1322.Sq \e& .
1323.It Sy "skipping paragraph macro"
1324In
1325.Xr mdoc 7
1326documents, this happens
1327.Bl -dash -compact
1328.It
1329at the beginning and end of sections and subsections
1330.It
1331right before non-compact lists and displays
1332.It
1333at the end of items in non-column, non-compact lists
1334.It
1335and for multiple consecutive paragraph macros.
1336.El
1337In
1338.Xr man 7
1339documents, it happens
1340.Bl -dash -compact
1341.It
1342for empty
1343.Ic \&P ,
1344.Ic \&PP ,
1345and
1346.Ic \&LP
1347macros
1348.It
1349for
1350.Ic \&IP
1351macros having neither head nor body arguments
1352.It
1353for
1354.Ic \&br
1355or
1356.Ic \&sp
1357right after
1358.Ic \&SH
1359or
1360.Ic \&SS
1361.El
1362.It Sy "moving paragraph macro out of list"
1363.Pq mdoc
1364A list item in a
1365.Ic \&Bl
1366list contains a trailing paragraph macro.
1367The paragraph macro is moved after the end of the list.
1368.It Sy "skipping no-space macro"
1369.Pq mdoc
1370An input line begins with an
1371.Ic \&Ns
1372macro, or the next argument after an
1373.Ic \&Ns
1374macro is an isolated closing delimiter.
1375The macro is ignored.
1376.It Sy "blocks badly nested"
1377.Pq mdoc
1378If two blocks intersect, one should completely contain the other.
1379Otherwise, rendered output is likely to look strange in any output
1380format, and rendering in SGML-based output formats is likely to be
1381outright wrong because such languages do not support badly nested
1382blocks at all.
1383Typical examples of badly nested blocks are
1384.Qq Ic \&Ao \&Bo \&Ac \&Bc
1385and
1386.Qq Ic \&Ao \&Bq \&Ac .
1387In these examples,
1388.Ic \&Ac
1389breaks
1390.Ic \&Bo
1391and
1392.Ic \&Bq ,
1393respectively.
1394.It Sy "nested displays are not portable"
1395.Pq mdoc
1396A
1397.Ic \&Bd ,
1398.Ic \&D1 ,
1399or
1400.Ic \&Dl
1401display occurs nested inside another
1402.Ic \&Bd
1403display.
1404This works with
1405.Nm ,
1406but fails with most other implementations.
1407.It Sy "moving content out of list"
1408.Pq mdoc
1409A
1410.Ic \&Bl
1411list block contains text or macros before the first
1412.Ic \&It
1413macro.
1414The offending children are moved before the beginning of the list.
1415.It Sy "first macro on line"
1416Inside a
1417.Ic \&Bl Fl column
1418list, a
1419.Ic \&Ta
1420macro occurs as the first macro on a line, which is not portable.
1421.It Sy "line scope broken"
1422.Pq man
1423While parsing the next-line scope of the previous macro,
1424another macro is found that prematurely terminates the previous one.
1425The previous, interrupted macro is deleted from the parse tree.
1426.El
1427.Ss "Warnings related to missing arguments"
1428.Bl -ohang
1429.It Sy "skipping empty request"
1430.Pq roff , eqn
1431The macro name is missing from a macro definition request,
1432or an
1433.Xr eqn 7
1434control statement or operation keyword lacks its required argument.
1435.It Sy "conditional request controls empty scope"
1436.Pq roff
1437A conditional request is only useful if any of the following
1438follows it on the same logical input line:
1439.Bl -dash -compact
1440.It
1441The
1442.Sq \e{
1443keyword to open a multi-line scope.
1444.It
1445A request or macro or some text, resulting in a single-line scope.
1446.It
1447The immediate end of the logical line without any intervening whitespace,
1448resulting in next-line scope.
1449.El
1450Here, a conditional request is followed by trailing whitespace only,
1451and there is no other content on its logical input line.
1452Note that it doesn't matter whether the logical input line is split
1453across multiple physical input lines using
1454.Sq \e
1455line continuation characters.
1456This is one of the rare cases
1457where trailing whitespace is syntactically significant.
1458The conditional request controls a scope containing whitespace only,
1459so it is unlikely to have a significant effect,
1460except that it may control a following
1461.Ic \&el
1462clause.
1463.It Sy "skipping empty macro"
1464.Pq mdoc
1465The indicated macro has no arguments and hence no effect.
1466.It Sy "empty block"
1467.Pq mdoc , man
1468A
1469.Ic \&Bd ,
1470.Ic \&Bk ,
1471.Ic \&Bl ,
1472.Ic \&D1 ,
1473.Ic \&Dl ,
1474or
1475.Ic \&RS
1476block contains nothing in its body and will produce no output.
1477.It Sy "empty argument, using 0n"
1478.Pq mdoc
1479The required width is missing after
1480.Ic \&Bd
1481or
1482.Ic \&Bl
1483.Fl offset
1484or
1485.Fl width .
1486.It Sy "missing display type, using -ragged"
1487.Pq mdoc
1488The
1489.Ic \&Bd
1490macro is invoked without the required display type.
1491.It Sy "list type is not the first argument"
1492.Pq mdoc
1493In a
1494.Ic \&Bl
1495macro, at least one other argument precedes the type argument.
1496The
1497.Nm
1498utility copes with any argument order, but some other
1499.Xr mdoc 7
1500implementations do not.
1501.It Sy "missing -width in -tag list, using 8n"
1502.Pq mdoc
1503Every
1504.Ic \&Bl
1505macro having the
1506.Fl tag
1507argument requires
1508.Fl width ,
1509too.
1510.It Sy "missing utility name, using \(dq\(dq"
1511.Pq mdoc
1512The
1513.Ic \&Ex Fl std
1514macro is called without an argument before
1515.Ic \&Nm
1516has first been called with an argument.
1517.It Sy "missing function name, using \(dq\(dq"
1518.Pq mdoc
1519The
1520.Ic \&Fo
1521macro is called without an argument.
1522No function name is printed.
1523.It Sy "empty head in list item"
1524.Pq mdoc
1525In a
1526.Ic \&Bl
1527.Fl diag ,
1528.Fl hang ,
1529.Fl inset ,
1530.Fl ohang ,
1531or
1532.Fl tag
1533list, an
1534.Ic \&It
1535macro lacks the required argument.
1536The item head is left empty.
1537.It Sy "empty list item"
1538.Pq mdoc
1539In a
1540.Ic \&Bl
1541.Fl bullet ,
1542.Fl dash ,
1543.Fl enum ,
1544or
1545.Fl hyphen
1546list, an
1547.Ic \&It
1548block is empty.
1549An empty list item is shown.
1550.It Sy "missing argument, using next line"
1551.Pq mdoc
1552An
1553.Ic \&It
1554macro in a
1555.Ic \&Bd Fl column
1556list has no arguments.
1557While
1558.Nm
1559uses the text or macros of the following line, if any, for the cell,
1560other formatters may misformat the list.
1561.It Sy "missing font type, using \efR"
1562.Pq mdoc
1563A
1564.Ic \&Bf
1565macro has no argument.
1566It switches to the default font.
1567.It Sy "unknown font type, using \efR"
1568.Pq mdoc
1569The
1570.Ic \&Bf
1571argument is invalid.
1572The default font is used instead.
1573.It Sy "nothing follows prefix"
1574.Pq mdoc
1575A
1576.Ic \&Pf
1577macro has no argument, or only one argument and no macro follows
1578on the same input line.
1579This defeats its purpose; in particular, spacing is not suppressed
1580before the text or macros following on the next input line.
1581.It Sy "empty reference block"
1582.Pq mdoc
1583An
1584.Ic \&Rs
1585macro is immediately followed by an
1586.Ic \&Re
1587macro on the next input line.
1588Such an empty block does not produce any output.
1589.It Sy "missing section argument"
1590.Pq mdoc
1591An
1592.Ic \&Xr
1593macro lacks its second, section number argument.
1594The first argument, i.e. the name, is printed, but without subsequent
1595parentheses.
1596.It Sy "missing -std argument, adding it"
1597.Pq mdoc
1598An
1599.Ic \&Ex
1600or
1601.Ic \&Rv
1602macro lacks the required
1603.Fl std
1604argument.
1605The
1606.Nm
1607utility assumes
1608.Fl std
1609even when it is not specified, but other implementations may not.
1610.It Sy "missing option string, using \(dq\(dq"
1611.Pq man
1612The
1613.Ic \&OP
1614macro is invoked without any argument.
1615An empty pair of square brackets is shown.
1616.It Sy "missing resource identifier, using \(dq\(dq"
1617.Pq man
1618The
1619.Ic \&MT
1620or
1621.Ic \&UR
1622macro is invoked without any argument.
1623An empty pair of angle brackets is shown.
1624.It Sy "missing eqn box, using \(dq\(dq"
1625.Pq eqn
1626A diacritic mark or a binary operator is found,
1627but there is nothing to the left of it.
1628An empty box is inserted.
1629.El
1630.Ss "Warnings related to bad macro arguments"
1631.Bl -ohang
1632.It Sy "duplicate argument"
1633.Pq mdoc
1634A
1635.Ic \&Bd
1636or
1637.Ic \&Bl
1638macro has more than one
1639.Fl compact ,
1640more than one
1641.Fl offset ,
1642or more than one
1643.Fl width
1644argument.
1645All but the last instances of these arguments are ignored.
1646.It Sy "skipping duplicate argument"
1647.Pq mdoc
1648An
1649.Ic \&An
1650macro has more than one
1651.Fl split
1652or
1653.Fl nosplit
1654argument.
1655All but the first of these arguments are ignored.
1656.It Sy "skipping duplicate display type"
1657.Pq mdoc
1658A
1659.Ic \&Bd
1660macro has more than one type argument; the first one is used.
1661.It Sy "skipping duplicate list type"
1662.Pq mdoc
1663A
1664.Ic \&Bl
1665macro has more than one type argument; the first one is used.
1666.It Sy "skipping -width argument"
1667.Pq mdoc
1668A
1669.Ic \&Bl
1670.Fl column ,
1671.Fl diag ,
1672.Fl ohang ,
1673.Fl inset ,
1674or
1675.Fl item
1676list has a
1677.Fl width
1678argument.
1679That has no effect.
1680.It Sy "wrong number of cells"
1681In a line of a
1682.Ic \&Bl Fl column
1683list, the number of tabs or
1684.Ic \&Ta
1685macros is less than the number expected from the list header line
1686or exceeds the expected number by more than one.
1687Missing cells remain empty, and all cells exceeding the number of
1688columns are joined into one single cell.
1689.It Sy "unknown AT&T UNIX version"
1690.Pq mdoc
1691An
1692.Ic \&At
1693macro has an invalid argument.
1694It is used verbatim, with
1695.Qq "AT&T UNIX "
1696prefixed to it.
1697.It Sy "comma in function argument"
1698.Pq mdoc
1699An argument of an
1700.Ic \&Fa
1701or
1702.Ic \&Fn
1703macro contains a comma; it should probably be split into two arguments.
1704.It Sy "parenthesis in function name"
1705.Pq mdoc
1706The first argument of an
1707.Ic \&Fc
1708or
1709.Ic \&Fn
1710macro contains an opening or closing parenthesis; that's probably wrong,
1711parentheses are added automatically.
1712.It Sy "unknown library name"
1713.Pq mdoc, not on Ox
1714An
1715.Ic \&Lb
1716macro has an unknown name argument and will be rendered as
1717.Qq library Dq Ar name .
1718.It Sy "invalid content in Rs block"
1719.Pq mdoc
1720An
1721.Ic \&Rs
1722block contains plain text or non-% macros.
1723The bogus content is left in the syntax tree.
1724Formatting may be poor.
1725.It Sy "invalid Boolean argument"
1726.Pq mdoc
1727An
1728.Ic \&Sm
1729macro has an argument other than
1730.Cm on
1731or
1732.Cm off .
1733The invalid argument is moved out of the macro, which leaves the macro
1734empty, causing it to toggle the spacing mode.
1735.It Sy "argument contains two font escapes"
1736.Pq roff
1737The second argument of a
1738.Ic char
1739request contains more than one font escape sequence.
1740A wrong font may remain active after using the character.
1741.It Sy "unknown font, skipping request"
1742.Pq man , tbl
1743A
1744.Xr roff 7
1745.Ic \&ft
1746request or a
1747.Xr tbl 7
1748.Ic \&f
1749layout modifier has an unknown
1750.Ar font
1751argument.
1752.It Sy "ignoring distance argument"
1753.Pq roff
1754In addition to the margin character, an
1755.Ic \&mc
1756request has a second argument supposed to represent a distance, but the
1757.Nm
1758implementation of
1759.Ic \&mc
1760always ignores the second argument.
1761.It Sy "odd number of characters in request"
1762.Pq roff
1763A
1764.Ic \&tr
1765request contains an odd number of characters.
1766The last character is mapped to the blank character.
1767.El
1768.Ss "Warnings related to plain text"
1769.Bl -ohang
1770.It Sy "blank line in fill mode, using .sp"
1771.Pq mdoc
1772The meaning of blank input lines is only well-defined in non-fill mode:
1773In fill mode, line breaks of text input lines are not supposed to be
1774significant.
1775However, for compatibility with groff, blank lines in fill mode
1776are formatted like
1777.Ic \&sp
1778requests.
1779To request a paragraph break, use
1780.Ic \&Pp
1781instead of a blank line.
1782.It Sy "tab in filled text"
1783.Pq mdoc , man
1784The meaning of tab characters is only well-defined in non-fill mode:
1785In fill mode, whitespace is not supposed to be significant
1786on text input lines.
1787As an implementation dependent choice, tab characters on text lines
1788are passed through to the formatters in any case.
1789Given that the text before the tab character will be filled,
1790it is hard to predict which tab stop position the tab will advance to.
1791.It Sy "new sentence, new line"
1792.Pq mdoc
1793A new sentence starts in the middle of a text line.
1794Start it on a new input line to help formatters produce correct spacing.
1795.It Sy "invalid escape sequence argument"
1796.Pq roff
1797The argument of an escape sequence is of an invalid form.
1798Invalid escape sequences are ignored.
1799.It Sy "undefined escape, printing literally"
1800.Pq roff
1801In an escape sequence, the first character
1802right after the leading backslash is invalid.
1803That character is printed literally,
1804which is equivalent to ignoring the backslash.
1805.It Sy "undefined string, using \(dq\(dq"
1806.Pq roff
1807If a string is used without being defined before,
1808its value is implicitly set to the empty string.
1809However, defining strings explicitly before use
1810keeps the code more readable.
1811.El
1812.Ss "Warnings related to tables"
1813.Bl -ohang
1814.It Sy "tbl line starts with span"
1815.Pq tbl
1816The first cell in a table layout line is a horizontal span
1817.Pq Sq Cm s .
1818Data provided for this cell is ignored, and nothing is printed in the cell.
1819.It Sy "tbl column starts with span"
1820.Pq tbl
1821The first line of a table layout specification
1822requests a vertical span
1823.Pq Sq Cm ^ .
1824Data provided for this cell is ignored, and nothing is printed in the cell.
1825.It Sy "skipping vertical bar in tbl layout"
1826.Pq tbl
1827A table layout specification contains more than two consecutive vertical bars.
1828A double bar is printed, all additional bars are discarded.
1829.El
1830.Ss "Errors related to tables"
1831.Bl -ohang
1832.It Sy "non-alphabetic character in tbl options"
1833.Pq tbl
1834The table options line contains a character other than a letter,
1835blank, or comma where the beginning of an option name is expected.
1836The character is ignored.
1837.It Sy "skipping unknown tbl option"
1838.Pq tbl
1839The table options line contains a string of letters that does not
1840match any known option name.
1841The word is ignored.
1842.It Sy "missing tbl option argument"
1843.Pq tbl
1844A table option that requires an argument is not followed by an
1845opening parenthesis, or the opening parenthesis is immediately
1846followed by a closing parenthesis.
1847The option is ignored.
1848.It Sy "wrong tbl option argument size"
1849.Pq tbl
1850A table option argument contains an invalid number of characters.
1851Both the option and the argument are ignored.
1852.It Sy "empty tbl layout"
1853.Pq tbl
1854A table layout specification is completely empty,
1855specifying zero lines and zero columns.
1856As a fallback, a single left-justified column is used.
1857.It Sy "invalid character in tbl layout"
1858.Pq tbl
1859A table layout specification contains a character that can neither
1860be interpreted as a layout key character nor as a layout modifier,
1861or a modifier precedes the first key.
1862The invalid character is discarded.
1863.It Sy "unmatched parenthesis in tbl layout"
1864.Pq tbl
1865A table layout specification contains an opening parenthesis,
1866but no matching closing parenthesis.
1867The rest of the input line, starting from the parenthesis, has no effect.
1868.It Sy "ignoring excessive spacing in tbl layout"
1869.Pq tbl
1870A spacing modifier in a table layout is unreasonably large.
1871The default spacing of 3n is used instead.
1872.It Sy "tbl without any data cells"
1873.Pq tbl
1874A table does not contain any data cells.
1875It will probably produce no output.
1876.It Sy "ignoring data in spanned tbl cell"
1877.Pq tbl
1878A table cell is marked as a horizontal span
1879.Pq Sq Cm s
1880or vertical span
1881.Pq Sq Cm ^
1882in the table layout, but it contains data.
1883The data is ignored.
1884.It Sy "ignoring extra tbl data cells"
1885.Pq tbl
1886A data line contains more cells than the corresponding layout line.
1887The data in the extra cells is ignored.
1888.It Sy "data block open at end of tbl"
1889.Pq tbl
1890A data block is opened with
1891.Cm T{ ,
1892but never closed with a matching
1893.Cm T} .
1894The remaining data lines of the table are all put into one cell,
1895and any remaining cells stay empty.
1896.El
1897.Ss "Errors related to roff, mdoc, and man code"
1898.Bl -ohang
1899.It Sy "duplicate prologue macro"
1900.Pq mdoc
1901One of the prologue macros occurs more than once.
1902The last instance overrides all previous ones.
1903.It Sy "skipping late title macro"
1904.Pq mdoc
1905The
1906.Ic \&Dt
1907macro appears after the first non-prologue macro.
1908Traditional formatters cannot handle this because
1909they write the page header before parsing the document body.
1910Even though this technical restriction does not apply to
1911.Nm ,
1912traditional semantics is preserved.
1913The late macro is discarded including its arguments.
1914.It Sy "input stack limit exceeded, infinite loop?"
1915.Pq roff
1916Explicit recursion limits are implemented for the following features,
1917in order to prevent infinite loops:
1918.Bl -dash -compact
1919.It
1920expansion of nested escape sequences
1921including expansion of strings and number registers,
1922.It
1923expansion of nested user-defined macros,
1924.It
1925and
1926.Ic \&so
1927file inclusion.
1928.El
1929When a limit is hit, the output is incorrect, typically losing
1930some content, but the parser can continue.
1931.It Sy "skipping bad character"
1932.Pq mdoc , man , roff
1933The input file contains a byte that is not a printable
1934.Xr ascii 7
1935character.
1936The message mentions the character number.
1937The offending byte is replaced with a question mark
1938.Pq Sq \&? .
1939Consider editing the input file to replace the byte with an ASCII
1940transliteration of the intended character.
1941.It Sy "skipping unknown macro"
1942.Pq mdoc , man , roff
1943The first identifier on a request or macro line is neither recognized as a
1944.Xr roff 7
1945request, nor as a user-defined macro, nor, respectively, as an
1946.Xr mdoc 7
1947or
1948.Xr man 7
1949macro.
1950It may be mistyped or unsupported.
1951The request or macro is discarded including its arguments.
1952.It Sy "skipping request outside macro"
1953.Pq roff
1954A
1955.Ic shift
1956or
1957.Ic return
1958request occurs outside any macro definition and has no effect.
1959.It Sy "skipping insecure request"
1960.Pq roff
1961An input file attempted to run a shell command
1962or to read or write an external file.
1963Such attempts are denied for security reasons.
1964.It Sy "skipping item outside list"
1965.Pq mdoc , eqn
1966An
1967.Ic \&It
1968macro occurs outside any
1969.Ic \&Bl
1970list, or an
1971.Xr eqn 7
1972.Ic above
1973delimiter occurs outside any pile.
1974It is discarded including its arguments.
1975.It Sy "skipping column outside column list"
1976.Pq mdoc
1977A
1978.Ic \&Ta
1979macro occurs outside any
1980.Ic \&Bl Fl column
1981block.
1982It is discarded including its arguments.
1983.It Sy "skipping end of block that is not open"
1984.Pq mdoc , man , eqn , tbl , roff
1985Various syntax elements can only be used to explicitly close blocks
1986that have previously been opened.
1987An
1988.Xr mdoc 7
1989block closing macro, a
1990.Xr man 7
1991.Ic \&ME , \&RE
1992or
1993.Ic \&UE
1994macro, an
1995.Xr eqn 7
1996right delimiter or closing brace, or the end of an equation, table, or
1997.Xr roff 7
1998conditional request is encountered but no matching block is open.
1999The offending request or macro is discarded.
2000.It Sy "fewer RS blocks open, skipping"
2001.Pq man
2002The
2003.Ic \&RE
2004macro is invoked with an argument, but less than the specified number of
2005.Ic \&RS
2006blocks is open.
2007The
2008.Ic \&RE
2009macro is discarded.
2010.It Sy "inserting missing end of block"
2011.Pq mdoc , tbl
2012Various
2013.Xr mdoc 7
2014macros as well as tables require explicit closing by dedicated macros.
2015A block that doesn't support bad nesting
2016ends before all of its children are properly closed.
2017The open child nodes are closed implicitly.
2018.It Sy "appending missing end of block"
2019.Pq mdoc , man , eqn , tbl , roff
2020At the end of the document, an explicit
2021.Xr mdoc 7
2022block, a
2023.Xr man 7
2024next-line scope or
2025.Ic \&MT , \&RS
2026or
2027.Ic \&UR
2028block, an equation, table, or
2029.Xr roff 7
2030conditional or ignore block is still open.
2031The open block is closed implicitly.
2032.It Sy "escaped character not allowed in a name"
2033.Pq roff
2034Macro, string and register identifiers consist of printable,
2035non-whitespace ASCII characters.
2036Escape sequences and characters and strings expressed in terms of them
2037cannot form part of a name.
2038The first argument of an
2039.Ic \&am ,
2040.Ic \&as ,
2041.Ic \&de ,
2042.Ic \&ds ,
2043.Ic \&nr ,
2044or
2045.Ic \&rr
2046request, or any argument of an
2047.Ic \&rm
2048request, or the name of a request or user defined macro being called,
2049is terminated by an escape sequence.
2050In the cases of
2051.Ic \&as ,
2052.Ic \&ds ,
2053and
2054.Ic \&nr ,
2055the request has no effect at all.
2056In the cases of
2057.Ic \&am ,
2058.Ic \&de ,
2059.Ic \&rr ,
2060and
2061.Ic \&rm ,
2062what was parsed up to this point is used as the arguments to the request,
2063and the rest of the input line is discarded including the escape sequence.
2064When parsing for a request or a user-defined macro name to be called,
2065only the escape sequence is discarded.
2066The characters preceding it are used as the request or macro name,
2067the characters following it are used as the arguments to the request or macro.
2068.It Sy "using macro argument outside macro"
2069.Pq roff
2070The escape sequence \e$ occurs outside any macro definition
2071and expands to the empty string.
2072.It Sy "argument number is not numeric"
2073.Pq roff
2074The argument of the escape sequence \e$ is not a digit;
2075the escape sequence expands to the empty string.
2076.It Sy "negative argument, using 0"
2077.Pq roff
2078A
2079.Ic \&shift
2080request has a negative argument
2081or an argument that is negative due to integer overflow.
2082Macro argument numbering remains unchanged.
2083.It Sy "NOT IMPLEMENTED: Bd -file"
2084.Pq mdoc
2085For security reasons, the
2086.Ic \&Bd
2087macro does not support the
2088.Fl file
2089argument.
2090By requesting the inclusion of a sensitive file, a malicious document
2091might otherwise trick a privileged user into inadvertently displaying
2092the file on the screen, revealing the file content to bystanders.
2093The argument is ignored including the file name following it.
2094.It Sy "skipping display without arguments"
2095.Pq mdoc
2096A
2097.Ic \&Bd
2098block macro does not have any arguments.
2099The block is discarded, and the block content is displayed in
2100whatever mode was active before the block.
2101.It Sy "missing list type, using -item"
2102.Pq mdoc
2103A
2104.Ic \&Bl
2105macro fails to specify the list type.
2106.It Sy "argument is not numeric, using 1"
2107.Pq roff
2108The argument of a
2109.Ic \&ce
2110request is not a number.
2111.It Sy "argument is not a character"
2112.Pq roff
2113The first argument of a
2114.Ic char
2115request is neither a single ASCII character
2116nor a single character escape sequence.
2117The request is ignored including all its arguments.
2118.It Sy "skipping unusable escape sequence"
2119.Pq roff
2120The first argument of an
2121.Ic mc
2122request is neither a single ASCII character
2123nor a single character escape sequence.
2124All arguments are ignored and printing of a margin character is disabled.
2125.It Sy "missing manual name, using \(dq\(dq"
2126.Pq mdoc
2127The first call to
2128.Ic \&Nm ,
2129or any call in the NAME section, lacks the required argument.
2130.It Sy "uname(3) system call failed, using UNKNOWN"
2131.Pq mdoc
2132The
2133.Ic \&Os
2134macro is called without arguments, and the
2135.Xr uname 3
2136system call failed.
2137As a workaround,
2138.Nm
2139can be compiled with
2140.Sm off
2141.Fl D Cm OSNAME=\(dq\e\(dq Ar string Cm \e\(dq\(dq .
2142.Sm on
2143.It Sy "unknown standard specifier"
2144.Pq mdoc
2145An
2146.Ic \&St
2147macro has an unknown argument and is discarded.
2148.It Sy "skipping request without numeric argument"
2149.Pq roff , eqn
2150An
2151.Ic \&it
2152request or an
2153.Xr eqn 7
2154.Ic \&size
2155or
2156.Ic \&gsize
2157statement has a non-numeric or negative argument or no argument at all.
2158The invalid request or statement is ignored.
2159.It Sy "excessive shift"
2160.Pq roff
2161The argument of a
2162.Ic shift
2163request is larger than the number of arguments of the macro that is
2164currently being executed.
2165All macro arguments are deleted and \en(.$ is set to zero.
2166.It Sy "NOT IMPLEMENTED: .so with absolute path or \(dq..\(dq"
2167.Pq roff
2168For security reasons,
2169.Nm
2170allows
2171.Ic \&so
2172file inclusion requests only with relative paths
2173and only without ascending to any parent directory.
2174By requesting the inclusion of a sensitive file, a malicious document
2175might otherwise trick a privileged user into inadvertently displaying
2176the file on the screen, revealing the file content to bystanders.
2177.Nm
2178only shows the path as it appears behind
2179.Ic \&so .
2180.It Sy ".so request failed"
2181.Pq roff
2182Servicing a
2183.Ic \&so
2184request requires reading an external file, but the file could not be
2185opened.
2186.Nm
2187only shows the path as it appears behind
2188.Ic \&so .
2189.It Sy "skipping all arguments"
2190.Pq mdoc , man , eqn , roff
2191An
2192.Xr mdoc 7
2193.Ic \&Bt ,
2194.Ic \&Ed ,
2195.Ic \&Ef ,
2196.Ic \&Ek ,
2197.Ic \&El ,
2198.Ic \&Lp ,
2199.Ic \&Pp ,
2200.Ic \&Re ,
2201.Ic \&Rs ,
2202or
2203.Ic \&Ud
2204macro, an
2205.Ic \&It
2206macro in a list that don't support item heads, a
2207.Xr man 7
2208.Ic \&LP ,
2209.Ic \&P ,
2210or
2211.Ic \&PP
2212macro, an
2213.Xr eqn 7
2214.Ic \&EQ
2215or
2216.Ic \&EN
2217macro, or a
2218.Xr roff 7
2219.Ic \&br ,
2220.Ic \&fi ,
2221or
2222.Ic \&nf
2223request or
2224.Sq \&..
2225block closing request is invoked with at least one argument.
2226All arguments are ignored.
2227.It Sy "skipping excess arguments"
2228.Pq mdoc , man , roff
2229A macro or request is invoked with too many arguments:
2230.Bl -dash -offset 2n -width 2n -compact
2231.It
2232.Ic \&Fo ,
2233.Ic \&MT ,
2234.Ic \&PD ,
2235.Ic \&RS ,
2236.Ic \&UR ,
2237.Ic \&ft ,
2238or
2239.Ic \&sp
2240with more than one argument
2241.It
2242.Ic \&An
2243with another argument after
2244.Fl split
2245or
2246.Fl nosplit
2247.It
2248.Ic \&RE
2249with more than one argument or with a non-integer argument
2250.It
2251.Ic \&OP
2252or a request of the
2253.Ic \&de
2254family with more than two arguments
2255.It
2256.Ic \&Dt
2257with more than three arguments
2258.It
2259.Ic \&TH
2260with more than five arguments
2261.It
2262.Ic \&Bd ,
2263.Ic \&Bk ,
2264or
2265.Ic \&Bl
2266with invalid arguments
2267.El
2268The excess arguments are ignored.
2269.El
2270.Ss "Errors related to escape sequences"
2271.Bl -ohang
2272.It Sy "incomplete escape sequence"
2273.Pq roff
2274The end of the input line is encountered
2275while parsing the argument of an escape sequence.
2276In this case,
2277.Ic \e*
2278and
2279.Ic \en
2280expand to an empty string,
2281.Ic \eB
2282to the digit
2283.Sq 0 ,
2284and
2285.Ic \ew
2286to the length of the incomplete argument.
2287All other incomplete escape sequences are ignored.
2288.It Sy "invalid special character"
2289.Pq roff
2290A special character escape sequence is invalid,
2291for example a Unicode sequence pointing to a surrogate
2292or beyond the Unicode range, a \e[char...] escape sequence
2293representing a control character or pointing beyond the
2294.Vt unsigned char
2295range, or an invalid variable-length form
2296of a single-byte character escape sequence, for example writing
2297.Qq \e[e]
2298or
2299.Qq \e[~]
2300instead of
2301.Qq \ee
2302or
2303.Qq \e~ ,
2304respectively.
2305The escape sequence is ignored.
2306.It Sy "unknown special character"
2307.Pq roff
2308The name given in a special character escape sequence is not known to
2309.Nm .
2310The escape sequence is ignored.
2311.It Sy "invalid escape argument delimiter"
2312.Pq roff
2313An escape sequence that expects a numerical argument
2314attempts to employ one of the characters
2315.Qq " %&()*+-./0123456789:<=>"
2316as an argument delimiter.
2317The escape sequence is ignored including the invalid opening delimiter
2318and the rest of the argument may appear as output text.
2319While various characters can be used as argument delimiters,
2320using the apostrophe-quote character
2321.Pq Sq \(aq
2322is recommended for readability and robustness.
2323.El
2324.Ss Unsupported features
2325.Bl -ohang
2326.It Sy "input too large"
2327.Pq mdoc , man
2328Currently,
2329.Nm
2330cannot handle input files larger than its arbitrary size limit
2331of 2^31 bytes (2 Gigabytes).
2332Since useful manuals are always small, this is not a problem in practice.
2333Parsing is aborted as soon as the condition is detected.
2334.It Sy "unsupported control character"
2335.Pq roff
2336An ASCII control character supported by other
2337.Xr roff 7
2338implementations but not by
2339.Nm
2340was found in an input file.
2341It is replaced by a question mark.
2342.It Sy "unsupported escape sequence"
2343.Pq roff
2344An input file contains an escape sequence supported by GNU troff
2345or Heirloom troff but not by
2346.Nm ,
2347and it is likely that this will cause information loss
2348or considerable misformatting.
2349.It Sy "unsupported roff request"
2350.Pq roff
2351An input file contains a
2352.Xr roff 7
2353request supported by GNU troff or Heirloom troff but not by
2354.Nm ,
2355and it is likely that this will cause information loss
2356or considerable misformatting.
2357.It Sy "eqn delim option in tbl"
2358.Pq eqn , tbl
2359The options line of a table defines equation delimiters.
2360Any equation source code contained in the table will be printed unformatted.
2361.It Sy "unsupported table layout modifier"
2362.Pq tbl
2363A table layout specification contains an
2364.Sq Cm m
2365modifier.
2366The modifier is discarded.
2367.It Sy "ignoring macro in table"
2368.Pq tbl , mdoc , man
2369A table contains an invocation of an
2370.Xr mdoc 7
2371or
2372.Xr man 7
2373macro or of an undefined macro.
2374The macro is ignored, and its arguments are handled
2375as if they were a text line.
2376.It Sy "skipping tbl in -Tman mode"
2377.Pq mdoc , tbl
2378An input file contains the
2379.Ic \&TS
2380macro.
2381This message is only generated in
2382.Fl T Cm man
2383output mode, where
2384.Xr tbl 7
2385input is not supported.
2386.It Sy "skipping eqn in -Tman mode"
2387.Pq mdoc , eqn
2388An input file contains the
2389.Ic \&EQ
2390macro.
2391This message is only generated in
2392.Fl T Cm man
2393output mode, where
2394.Xr eqn 7
2395input is not supported.
2396.El
2397.Ss Bad command line arguments
2398.Bl -ohang
2399.It Sy "bad command line argument"
2400The argument following one of the
2401.Fl IKMmOTW
2402command line options is invalid, or a
2403.Ar file
2404given as a command line argument cannot be opened.
2405.It Sy "duplicate command line argument"
2406The
2407.Fl I
2408command line option was specified twice.
2409.It Sy "option has a superfluous value"
2410An argument to the
2411.Fl O
2412option has a value but does not accept one.
2413.It Sy "missing option value"
2414An argument to the
2415.Fl O
2416option has no argument but requires one.
2417.It Sy "bad option value"
2418An argument to the
2419.Fl O
2420.Cm indent
2421or
2422.Cm width
2423option has an invalid value.
2424.It Sy "duplicate option value"
2425The same
2426.Fl O
2427option is specified more than once.
2428.It Sy "no such tag"
2429The
2430.Fl O Cm tag
2431option was specified but the tag was not found in any of the displayed
2432manual pages.
2433.It Sy "\-Tmarkdown unsupported for man(7) input"
2434.Pq man
2435The
2436.Fl T Cm markdown
2437option was specified but an input file uses the
2438.Xr man 7
2439language.
2440No output is produced for that input file.
2441.El
2442.Sh SEE ALSO
2443.Xr apropos 1 ,
2444.Xr man 1 ,
2445.Xr eqn 7 ,
2446.Xr man 7 ,
2447.Xr mandoc_char 7 ,
2448.Xr mdoc 7 ,
2449.Xr roff 7 ,
2450.Xr tbl 7
2451.Sh HISTORY
2452The
2453.Nm
2454utility first appeared in
2455.Ox 4.8 .
2456The option
2457.Fl I
2458appeared in
2459.Ox 5.2 ,
2460and
2461.Fl aCcfhKklMSsw
2462in
2463.Ox 5.7 .
2464.Sh AUTHORS
2465.An -nosplit
2466The
2467.Nm
2468utility was written by
2469.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
2470and is maintained by
2471.An Ingo Schwarze Aq Mt schwarze@openbsd.org .
2472