xref: /minix3/external/bsd/mdocml/dist/mandoc.1 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	Id: mandoc.1,v 1.103 2013/07/13 19:41:16 schwarze Exp
2d65f6f70SBen Gras.\"
392395e9cSLionel Sambuc.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
5d65f6f70SBen Gras.\"
6d65f6f70SBen Gras.\" Permission to use, copy, modify, and distribute this software for any
7d65f6f70SBen Gras.\" purpose with or without fee is hereby granted, provided that the above
8d65f6f70SBen Gras.\" copyright notice and this permission notice appear in all copies.
9d65f6f70SBen Gras.\"
10d65f6f70SBen Gras.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11d65f6f70SBen Gras.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12d65f6f70SBen Gras.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13d65f6f70SBen Gras.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14d65f6f70SBen Gras.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15d65f6f70SBen Gras.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16d65f6f70SBen Gras.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17d65f6f70SBen Gras.\"
18*0a6a1f1dSLionel Sambuc.Dd July 13, 2013
19d65f6f70SBen Gras.Dt MANDOC 1
20d65f6f70SBen Gras.Os
21d65f6f70SBen Gras.Sh NAME
22d65f6f70SBen Gras.Nm mandoc
23d65f6f70SBen Gras.Nd format and display UNIX manuals
24d65f6f70SBen Gras.Sh SYNOPSIS
25d65f6f70SBen Gras.Nm mandoc
26d65f6f70SBen Gras.Op Fl V
27*0a6a1f1dSLionel Sambuc.Sm off
28*0a6a1f1dSLionel Sambuc.Op Fl I Cm os Li = Ar name
29*0a6a1f1dSLionel Sambuc.Sm on
30d65f6f70SBen Gras.Op Fl m Ns Ar format
31d65f6f70SBen Gras.Op Fl O Ns Ar option
32d65f6f70SBen Gras.Op Fl T Ns Ar output
33d65f6f70SBen Gras.Op Fl W Ns Ar level
3492395e9cSLionel Sambuc.Op Ar
35d65f6f70SBen Gras.Sh DESCRIPTION
36d65f6f70SBen GrasThe
37d65f6f70SBen Gras.Nm
38d65f6f70SBen Grasutility formats
39d65f6f70SBen Gras.Ux
40d65f6f70SBen Grasmanual pages for display.
4192395e9cSLionel Sambuc.Pp
4292395e9cSLionel SambucBy default,
4392395e9cSLionel Sambuc.Nm
4492395e9cSLionel Sambucreads
4592395e9cSLionel Sambuc.Xr mdoc 7
4692395e9cSLionel Sambucor
4792395e9cSLionel Sambuc.Xr man 7
4892395e9cSLionel Sambuctext from stdin, implying
4992395e9cSLionel Sambuc.Fl m Ns Cm andoc ,
5092395e9cSLionel Sambucand produces
5192395e9cSLionel Sambuc.Fl T Ns Cm ascii
5292395e9cSLionel Sambucoutput.
5392395e9cSLionel Sambuc.Pp
54d65f6f70SBen GrasThe arguments are as follows:
55d65f6f70SBen Gras.Bl -tag -width Ds
56*0a6a1f1dSLionel Sambuc.Sm off
57*0a6a1f1dSLionel Sambuc.It Fl I Cm os Li = Ar name
58*0a6a1f1dSLionel Sambuc.Sm on
59*0a6a1f1dSLionel SambucOverride the default operating system
60*0a6a1f1dSLionel Sambuc.Ar name
61*0a6a1f1dSLionel Sambucfor the
62*0a6a1f1dSLionel Sambuc.Xr mdoc 7
63*0a6a1f1dSLionel Sambuc.Sq \&Os
64*0a6a1f1dSLionel Sambucmacro.
65d65f6f70SBen Gras.It Fl m Ns Ar format
66d65f6f70SBen GrasInput format.
67d65f6f70SBen GrasSee
68d65f6f70SBen Gras.Sx Input Formats
69d65f6f70SBen Grasfor available formats.
70d65f6f70SBen GrasDefaults to
71d65f6f70SBen Gras.Fl m Ns Cm andoc .
72d65f6f70SBen Gras.It Fl O Ns Ar option
73d65f6f70SBen GrasComma-separated output options.
74d65f6f70SBen Gras.It Fl T Ns Ar output
75d65f6f70SBen GrasOutput format.
76d65f6f70SBen GrasSee
77d65f6f70SBen Gras.Sx Output Formats
78d65f6f70SBen Grasfor available formats.
79d65f6f70SBen GrasDefaults to
80d65f6f70SBen Gras.Fl T Ns Cm ascii .
81d65f6f70SBen Gras.It Fl V
82d65f6f70SBen GrasPrint version and exit.
83d65f6f70SBen Gras.It Fl W Ns Ar level
84d65f6f70SBen GrasSpecify the minimum message
85d65f6f70SBen Gras.Ar level
86d65f6f70SBen Grasto be reported on the standard error output and to affect the exit status.
87d65f6f70SBen GrasThe
88d65f6f70SBen Gras.Ar level
89d65f6f70SBen Grascan be
90d65f6f70SBen Gras.Cm warning ,
91d65f6f70SBen Gras.Cm error ,
92d65f6f70SBen Grasor
93d65f6f70SBen Gras.Cm fatal .
94d65f6f70SBen GrasThe default is
95d65f6f70SBen Gras.Fl W Ns Cm fatal ;
96d65f6f70SBen Gras.Fl W Ns Cm all
97d65f6f70SBen Grasis an alias for
98d65f6f70SBen Gras.Fl W Ns Cm warning .
99d65f6f70SBen GrasSee
100d65f6f70SBen Gras.Sx EXIT STATUS
101d65f6f70SBen Grasand
102d65f6f70SBen Gras.Sx DIAGNOSTICS
103d65f6f70SBen Grasfor details.
104d65f6f70SBen Gras.Pp
105d65f6f70SBen GrasThe special option
106d65f6f70SBen Gras.Fl W Ns Cm stop
107d65f6f70SBen Grastells
108d65f6f70SBen Gras.Nm
109d65f6f70SBen Grasto exit after parsing a file that causes warnings or errors of at least
110d65f6f70SBen Grasthe requested level.
111d65f6f70SBen GrasNo formatted output will be produced from that file.
112d65f6f70SBen GrasIf both a
113d65f6f70SBen Gras.Ar level
114d65f6f70SBen Grasand
115d65f6f70SBen Gras.Cm stop
116d65f6f70SBen Grasare requested, they can be joined with a comma, for example
117d65f6f70SBen Gras.Fl W Ns Cm error , Ns Cm stop .
118d65f6f70SBen Gras.It Ar file
119d65f6f70SBen GrasRead input from zero or more files.
120d65f6f70SBen GrasIf unspecified, reads from stdin.
121d65f6f70SBen GrasIf multiple files are specified,
122d65f6f70SBen Gras.Nm
123d65f6f70SBen Graswill halt with the first failed parse.
124d65f6f70SBen Gras.El
125d65f6f70SBen Gras.Ss Input Formats
126d65f6f70SBen GrasThe
127d65f6f70SBen Gras.Nm
128d65f6f70SBen Grasutility accepts
129d65f6f70SBen Gras.Xr mdoc 7
130d65f6f70SBen Grasand
131d65f6f70SBen Gras.Xr man 7
132d65f6f70SBen Grasinput with
133d65f6f70SBen Gras.Fl m Ns Cm doc
134d65f6f70SBen Grasand
135d65f6f70SBen Gras.Fl m Ns Cm an ,
136d65f6f70SBen Grasrespectively.
137d65f6f70SBen GrasThe
138d65f6f70SBen Gras.Xr mdoc 7
139d65f6f70SBen Grasformat is
140d65f6f70SBen Gras.Em strongly
141d65f6f70SBen Grasrecommended;
142d65f6f70SBen Gras.Xr man 7
143d65f6f70SBen Grasshould only be used for legacy manuals.
144d65f6f70SBen Gras.Pp
145d65f6f70SBen GrasA third option,
146d65f6f70SBen Gras.Fl m Ns Cm andoc ,
147d65f6f70SBen Graswhich is also the default, determines encoding on-the-fly: if the first
148d65f6f70SBen Grasnon-comment macro is
149d65f6f70SBen Gras.Sq \&Dd
150d65f6f70SBen Grasor
151d65f6f70SBen Gras.Sq \&Dt ,
152d65f6f70SBen Grasthe
153d65f6f70SBen Gras.Xr mdoc 7
154d65f6f70SBen Grasparser is used; otherwise, the
155d65f6f70SBen Gras.Xr man 7
156d65f6f70SBen Grasparser is used.
157d65f6f70SBen Gras.Pp
158d65f6f70SBen GrasIf multiple
159d65f6f70SBen Grasfiles are specified with
160d65f6f70SBen Gras.Fl m Ns Cm andoc ,
161d65f6f70SBen Graseach has its file-type determined this way.
162d65f6f70SBen GrasIf multiple files are
163d65f6f70SBen Grasspecified and
164d65f6f70SBen Gras.Fl m Ns Cm doc
165d65f6f70SBen Grasor
166d65f6f70SBen Gras.Fl m Ns Cm an
167d65f6f70SBen Grasis specified, then this format is used exclusively.
168d65f6f70SBen Gras.Ss Output Formats
169d65f6f70SBen GrasThe
170d65f6f70SBen Gras.Nm
171d65f6f70SBen Grasutility accepts the following
172d65f6f70SBen Gras.Fl T
173d65f6f70SBen Grasarguments, which correspond to output modes:
17492395e9cSLionel Sambuc.Bl -tag -width "-Tlocale"
175d65f6f70SBen Gras.It Fl T Ns Cm ascii
176d65f6f70SBen GrasProduce 7-bit ASCII output.
177d65f6f70SBen GrasThis is the default.
178d65f6f70SBen GrasSee
179d65f6f70SBen Gras.Sx ASCII Output .
180d65f6f70SBen Gras.It Fl T Ns Cm html
181d65f6f70SBen GrasProduce strict CSS1/HTML-4.01 output.
182d65f6f70SBen GrasSee
183d65f6f70SBen Gras.Sx HTML Output .
184d65f6f70SBen Gras.It Fl T Ns Cm lint
185d65f6f70SBen GrasParse only: produce no output.
186d65f6f70SBen GrasImplies
187d65f6f70SBen Gras.Fl W Ns Cm warning .
18892395e9cSLionel Sambuc.It Fl T Ns Cm locale
18992395e9cSLionel SambucEncode output using the current locale.
19092395e9cSLionel SambucSee
19192395e9cSLionel Sambuc.Sx Locale Output .
19292395e9cSLionel Sambuc.It Fl T Ns Cm man
19392395e9cSLionel SambucProduce
19492395e9cSLionel Sambuc.Xr man 7
19592395e9cSLionel Sambucformat output.
19692395e9cSLionel SambucSee
19792395e9cSLionel Sambuc.Sx Man Output .
198d65f6f70SBen Gras.It Fl T Ns Cm pdf
199d65f6f70SBen GrasProduce PDF output.
200d65f6f70SBen GrasSee
201d65f6f70SBen Gras.Sx PDF Output .
202d65f6f70SBen Gras.It Fl T Ns Cm ps
203d65f6f70SBen GrasProduce PostScript output.
204d65f6f70SBen GrasSee
205d65f6f70SBen Gras.Sx PostScript Output .
206d65f6f70SBen Gras.It Fl T Ns Cm tree
207d65f6f70SBen GrasProduce an indented parse tree.
20892395e9cSLionel Sambuc.It Fl T Ns Cm utf8
20992395e9cSLionel SambucEncode output in the UTF\-8 multi-byte format.
21092395e9cSLionel SambucSee
21192395e9cSLionel Sambuc.Sx UTF\-8 Output .
212d65f6f70SBen Gras.It Fl T Ns Cm xhtml
213d65f6f70SBen GrasProduce strict CSS1/XHTML-1.0 output.
214d65f6f70SBen GrasSee
215d65f6f70SBen Gras.Sx XHTML Output .
216d65f6f70SBen Gras.El
217d65f6f70SBen Gras.Pp
218d65f6f70SBen GrasIf multiple input files are specified, these will be processed by the
219d65f6f70SBen Grascorresponding filter in-order.
220d65f6f70SBen Gras.Ss ASCII Output
221d65f6f70SBen GrasOutput produced by
222d65f6f70SBen Gras.Fl T Ns Cm ascii ,
223d65f6f70SBen Graswhich is the default, is rendered in standard 7-bit ASCII documented in
224d65f6f70SBen Gras.Xr ascii 7 .
225d65f6f70SBen Gras.Pp
226d65f6f70SBen GrasFont styles are applied by using back-spaced encoding such that an
227d65f6f70SBen Grasunderlined character
228d65f6f70SBen Gras.Sq c
229d65f6f70SBen Grasis rendered as
230d65f6f70SBen Gras.Sq _ Ns \e[bs] Ns c ,
231d65f6f70SBen Graswhere
232d65f6f70SBen Gras.Sq \e[bs]
233d65f6f70SBen Grasis the back-space character number 8.
234d65f6f70SBen GrasEmboldened characters are rendered as
235d65f6f70SBen Gras.Sq c Ns \e[bs] Ns c .
236d65f6f70SBen Gras.Pp
237d65f6f70SBen GrasThe special characters documented in
238d65f6f70SBen Gras.Xr mandoc_char 7
239d65f6f70SBen Grasare rendered best-effort in an ASCII equivalent.
24092395e9cSLionel SambucIf no equivalent is found,
24192395e9cSLionel Sambuc.Sq \&?
24292395e9cSLionel Sambucis used instead.
243d65f6f70SBen Gras.Pp
244d65f6f70SBen GrasOutput width is limited to 78 visible columns unless literal input lines
245d65f6f70SBen Grasexceed this limit.
246d65f6f70SBen Gras.Pp
247d65f6f70SBen GrasThe following
248d65f6f70SBen Gras.Fl O
249d65f6f70SBen Grasarguments are accepted:
250d65f6f70SBen Gras.Bl -tag -width Ds
25192395e9cSLionel Sambuc.It Cm indent Ns = Ns Ar indent
25292395e9cSLionel SambucThe left margin for normal text is set to
25392395e9cSLionel Sambuc.Ar indent
25492395e9cSLionel Sambucblank characters instead of the default of five for
25592395e9cSLionel Sambuc.Xr mdoc 7
25692395e9cSLionel Sambucand seven for
25792395e9cSLionel Sambuc.Xr man 7 .
25892395e9cSLionel SambucIncreasing this is not recommended; it may result in degraded formatting,
25992395e9cSLionel Sambucfor example overfull lines or ugly line breaks.
260d65f6f70SBen Gras.It Cm width Ns = Ns Ar width
261d65f6f70SBen GrasThe output width is set to
262d65f6f70SBen Gras.Ar width ,
263d65f6f70SBen Graswhich will normalise to \(>=60.
264d65f6f70SBen Gras.El
265d65f6f70SBen Gras.Ss HTML Output
266d65f6f70SBen GrasOutput produced by
267d65f6f70SBen Gras.Fl T Ns Cm html
268d65f6f70SBen Grasconforms to HTML-4.01 strict.
269d65f6f70SBen Gras.Pp
270d65f6f70SBen GrasThe
271d65f6f70SBen Gras.Pa example.style.css
272d65f6f70SBen Grasfile documents style-sheet classes available for customising output.
273d65f6f70SBen GrasIf a style-sheet is not specified with
274d65f6f70SBen Gras.Fl O Ns Ar style ,
275d65f6f70SBen Gras.Fl T Ns Cm html
276d65f6f70SBen Grasdefaults to simple output readable in any graphical or text-based web
277d65f6f70SBen Grasbrowser.
278d65f6f70SBen Gras.Pp
27992395e9cSLionel SambucSpecial characters are rendered in decimal-encoded UTF\-8.
280d65f6f70SBen Gras.Pp
281d65f6f70SBen GrasThe following
282d65f6f70SBen Gras.Fl O
283d65f6f70SBen Grasarguments are accepted:
284d65f6f70SBen Gras.Bl -tag -width Ds
28592395e9cSLionel Sambuc.It Cm fragment
28692395e9cSLionel SambucOmit the
28792395e9cSLionel Sambuc.Aq !DOCTYPE
28892395e9cSLionel Sambucdeclaration and the
28992395e9cSLionel Sambuc.Aq html ,
29092395e9cSLionel Sambuc.Aq head ,
29192395e9cSLionel Sambucand
29292395e9cSLionel Sambuc.Aq body
29392395e9cSLionel Sambucelements and only emit the subtree below the
29492395e9cSLionel Sambuc.Aq body
29592395e9cSLionel Sambucelement.
29692395e9cSLionel SambucThe
29792395e9cSLionel Sambuc.Cm style
29892395e9cSLionel Sambucargument will be ignored.
29992395e9cSLionel SambucThis is useful when embedding manual content within existing documents.
300d65f6f70SBen Gras.It Cm includes Ns = Ns Ar fmt
301d65f6f70SBen GrasThe string
302d65f6f70SBen Gras.Ar fmt ,
303d65f6f70SBen Grasfor example,
304d65f6f70SBen Gras.Ar ../src/%I.html ,
305d65f6f70SBen Grasis used as a template for linked header files (usually via the
306d65f6f70SBen Gras.Sq \&In
307d65f6f70SBen Grasmacro).
308d65f6f70SBen GrasInstances of
309d65f6f70SBen Gras.Sq \&%I
310d65f6f70SBen Grasare replaced with the include filename.
311d65f6f70SBen GrasThe default is not to present a
312d65f6f70SBen Grashyperlink.
313d65f6f70SBen Gras.It Cm man Ns = Ns Ar fmt
314d65f6f70SBen GrasThe string
315d65f6f70SBen Gras.Ar fmt ,
316d65f6f70SBen Grasfor example,
317d65f6f70SBen Gras.Ar ../html%S/%N.%S.html ,
318d65f6f70SBen Grasis used as a template for linked manuals (usually via the
319d65f6f70SBen Gras.Sq \&Xr
320d65f6f70SBen Grasmacro).
321d65f6f70SBen GrasInstances of
322d65f6f70SBen Gras.Sq \&%N
323d65f6f70SBen Grasand
324d65f6f70SBen Gras.Sq %S
325d65f6f70SBen Grasare replaced with the linked manual's name and section, respectively.
326d65f6f70SBen GrasIf no section is included, section 1 is assumed.
327d65f6f70SBen GrasThe default is not to
328d65f6f70SBen Graspresent a hyperlink.
329d65f6f70SBen Gras.It Cm style Ns = Ns Ar style.css
330d65f6f70SBen GrasThe file
331d65f6f70SBen Gras.Ar style.css
332d65f6f70SBen Grasis used for an external style-sheet.
333d65f6f70SBen GrasThis must be a valid absolute or
334d65f6f70SBen Grasrelative URI.
335d65f6f70SBen Gras.El
33692395e9cSLionel Sambuc.Ss Locale Output
33792395e9cSLionel SambucLocale-depending output encoding is triggered with
33892395e9cSLionel Sambuc.Fl T Ns Cm locale .
33992395e9cSLionel SambucThis option is not available on all systems: systems without locale
34092395e9cSLionel Sambucsupport, or those whose internal representation is not natively UCS-4,
34192395e9cSLionel Sambucwill fall back to
34292395e9cSLionel Sambuc.Fl T Ns Cm ascii .
34392395e9cSLionel SambucSee
34492395e9cSLionel Sambuc.Sx ASCII Output
34592395e9cSLionel Sambucfor font style specification and available command-line arguments.
34692395e9cSLionel Sambuc.Ss Man Output
34792395e9cSLionel SambucTranslate input format into
34892395e9cSLionel Sambuc.Xr man 7
34992395e9cSLionel Sambucoutput format.
350*0a6a1f1dSLionel SambucThis is useful for distributing manual sources to legacy systems
35192395e9cSLionel Sambuclacking
35292395e9cSLionel Sambuc.Xr mdoc 7
35392395e9cSLionel Sambucformatters.
35492395e9cSLionel Sambuc.Pp
35592395e9cSLionel SambucIf
35692395e9cSLionel Sambuc.Xr mdoc 7
35792395e9cSLionel Sambucis passed as input, it is translated into
35892395e9cSLionel Sambuc.Xr man 7 .
35992395e9cSLionel SambucIf the input format is
36092395e9cSLionel Sambuc.Xr man 7 ,
36192395e9cSLionel Sambucthe input is copied to the output, expanding any
36292395e9cSLionel Sambuc.Xr roff 7
36392395e9cSLionel Sambuc.Sq so
36492395e9cSLionel Sambucrequests.
36592395e9cSLionel SambucThe parser is also run, and as usual, the
36692395e9cSLionel Sambuc.Fl W
36792395e9cSLionel Sambuclevel controls which
36892395e9cSLionel Sambuc.Sx DIAGNOSTICS
36992395e9cSLionel Sambucare displayed before copying the input to the output.
37092395e9cSLionel Sambuc.Ss PDF Output
37192395e9cSLionel SambucPDF-1.1 output may be generated by
37292395e9cSLionel Sambuc.Fl T Ns Cm pdf .
37392395e9cSLionel SambucSee
37492395e9cSLionel Sambuc.Sx PostScript Output
37592395e9cSLionel Sambucfor
37692395e9cSLionel Sambuc.Fl O
37792395e9cSLionel Sambucarguments and defaults.
378d65f6f70SBen Gras.Ss PostScript Output
379d65f6f70SBen GrasPostScript
380d65f6f70SBen Gras.Qq Adobe-3.0
381d65f6f70SBen GrasLevel-2 pages may be generated by
382d65f6f70SBen Gras.Fl T Ns Cm ps .
383d65f6f70SBen GrasOutput pages default to letter sized and are rendered in the Times font
384d65f6f70SBen Grasfamily, 11-point.
385d65f6f70SBen GrasMargins are calculated as 1/9 the page length and width.
386d65f6f70SBen GrasLine-height is 1.4m.
387d65f6f70SBen Gras.Pp
388d65f6f70SBen GrasSpecial characters are rendered as in
389d65f6f70SBen Gras.Sx ASCII Output .
390d65f6f70SBen Gras.Pp
391d65f6f70SBen GrasThe following
392d65f6f70SBen Gras.Fl O
393d65f6f70SBen Grasarguments are accepted:
394d65f6f70SBen Gras.Bl -tag -width Ds
395d65f6f70SBen Gras.It Cm paper Ns = Ns Ar name
396d65f6f70SBen GrasThe paper size
397d65f6f70SBen Gras.Ar name
398d65f6f70SBen Grasmay be one of
399d65f6f70SBen Gras.Ar a3 ,
400d65f6f70SBen Gras.Ar a4 ,
401d65f6f70SBen Gras.Ar a5 ,
402d65f6f70SBen Gras.Ar legal ,
403d65f6f70SBen Grasor
404d65f6f70SBen Gras.Ar letter .
405d65f6f70SBen GrasYou may also manually specify dimensions as
406d65f6f70SBen Gras.Ar NNxNN ,
407d65f6f70SBen Graswidth by height in millimetres.
408d65f6f70SBen GrasIf an unknown value is encountered,
409d65f6f70SBen Gras.Ar letter
410d65f6f70SBen Grasis used.
411d65f6f70SBen Gras.El
41292395e9cSLionel Sambuc.Ss UTF\-8 Output
41392395e9cSLionel SambucUse
41492395e9cSLionel Sambuc.Fl T Ns Cm utf8
41592395e9cSLionel Sambucto force a UTF\-8 locale.
416d65f6f70SBen GrasSee
41792395e9cSLionel Sambuc.Sx Locale Output
41892395e9cSLionel Sambucfor details and options.
419d65f6f70SBen Gras.Ss XHTML Output
420d65f6f70SBen GrasOutput produced by
421d65f6f70SBen Gras.Fl T Ns Cm xhtml
422d65f6f70SBen Grasconforms to XHTML-1.0 strict.
423d65f6f70SBen Gras.Pp
424d65f6f70SBen GrasSee
425d65f6f70SBen Gras.Sx HTML Output
426d65f6f70SBen Grasfor details; beyond generating XHTML tags instead of HTML tags, these
427d65f6f70SBen Grasoutput modes are identical.
428d65f6f70SBen Gras.Sh EXIT STATUS
429d65f6f70SBen GrasThe
430d65f6f70SBen Gras.Nm
431d65f6f70SBen Grasutility exits with one of the following values, controlled by the message
432d65f6f70SBen Gras.Ar level
433d65f6f70SBen Grasassociated with the
434d65f6f70SBen Gras.Fl W
435d65f6f70SBen Grasoption:
436d65f6f70SBen Gras.Pp
437d65f6f70SBen Gras.Bl -tag -width Ds -compact
438d65f6f70SBen Gras.It 0
439d65f6f70SBen GrasNo warnings or errors occurred, or those that did were ignored because
440d65f6f70SBen Grasthey were lower than the requested
441d65f6f70SBen Gras.Ar level .
442d65f6f70SBen Gras.It 2
443d65f6f70SBen GrasAt least one warning occurred, but no error, and
444d65f6f70SBen Gras.Fl W Ns Cm warning
445d65f6f70SBen Graswas specified.
446d65f6f70SBen Gras.It 3
447d65f6f70SBen GrasAt least one parsing error occurred, but no fatal error, and
448d65f6f70SBen Gras.Fl W Ns Cm error
449d65f6f70SBen Grasor
450d65f6f70SBen Gras.Fl W Ns Cm warning
451d65f6f70SBen Graswas specified.
452d65f6f70SBen Gras.It 4
453d65f6f70SBen GrasA fatal parsing error occurred.
454d65f6f70SBen Gras.It 5
455d65f6f70SBen GrasInvalid command line arguments were specified.
456d65f6f70SBen GrasNo input files have been read.
457d65f6f70SBen Gras.It 6
458d65f6f70SBen GrasAn operating system error occurred, for example memory exhaustion or an
459d65f6f70SBen Graserror accessing input files.
460d65f6f70SBen GrasSuch errors cause
461d65f6f70SBen Gras.Nm
462d65f6f70SBen Grasto exit at once, possibly in the middle of parsing or formatting a file.
463d65f6f70SBen Gras.El
464d65f6f70SBen Gras.Pp
465d65f6f70SBen GrasNote that selecting
466d65f6f70SBen Gras.Fl T Ns Cm lint
467d65f6f70SBen Grasoutput mode implies
468d65f6f70SBen Gras.Fl W Ns Cm warning .
469d65f6f70SBen Gras.Sh EXAMPLES
470d65f6f70SBen GrasTo page manuals to the terminal:
471d65f6f70SBen Gras.Pp
472d65f6f70SBen Gras.Dl $ mandoc \-Wall,stop mandoc.1 2\*(Gt&1 | less
473d65f6f70SBen Gras.Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
474d65f6f70SBen Gras.Pp
475d65f6f70SBen GrasTo produce HTML manuals with
476d65f6f70SBen Gras.Ar style.css
477d65f6f70SBen Grasas the style-sheet:
478d65f6f70SBen Gras.Pp
479d65f6f70SBen Gras.Dl $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
480d65f6f70SBen Gras.Pp
481d65f6f70SBen GrasTo check over a large set of manuals:
482d65f6f70SBen Gras.Pp
483d65f6f70SBen Gras.Dl $ mandoc \-Tlint `find /usr/src -name \e*\e.[1-9]`
484d65f6f70SBen Gras.Pp
485d65f6f70SBen GrasTo produce a series of PostScript manuals for A4 paper:
486d65f6f70SBen Gras.Pp
487d65f6f70SBen Gras.Dl $ mandoc \-Tps \-Opaper=a4 mdoc.7 man.7 \*(Gt manuals.ps
48892395e9cSLionel Sambuc.Pp
48992395e9cSLionel SambucConvert a modern
49092395e9cSLionel Sambuc.Xr mdoc 7
49192395e9cSLionel Sambucmanual to the older
49292395e9cSLionel Sambuc.Xr man 7
49392395e9cSLionel Sambucformat, for use on systems lacking an
49492395e9cSLionel Sambuc.Xr mdoc 7
49592395e9cSLionel Sambucparser:
49692395e9cSLionel Sambuc.Pp
49792395e9cSLionel Sambuc.Dl $ mandoc \-Tman foo.mdoc \*(Gt foo.man
498d65f6f70SBen Gras.Sh DIAGNOSTICS
499d65f6f70SBen GrasStandard error messages reporting parsing errors are prefixed by
500d65f6f70SBen Gras.Pp
501d65f6f70SBen Gras.Sm off
502d65f6f70SBen Gras.D1 Ar file : line : column : \ level :
503d65f6f70SBen Gras.Sm on
504d65f6f70SBen Gras.Pp
505d65f6f70SBen Graswhere the fields have the following meanings:
506d65f6f70SBen Gras.Bl -tag -width "column"
507d65f6f70SBen Gras.It Ar file
508d65f6f70SBen GrasThe name of the input file causing the message.
509d65f6f70SBen Gras.It Ar line
510d65f6f70SBen GrasThe line number in that input file.
511d65f6f70SBen GrasLine numbering starts at 1.
512d65f6f70SBen Gras.It Ar column
513d65f6f70SBen GrasThe column number in that input file.
514d65f6f70SBen GrasColumn numbering starts at 1.
515d65f6f70SBen GrasIf the issue is caused by a word, the column number usually
516d65f6f70SBen Graspoints to the first character of the word.
517d65f6f70SBen Gras.It Ar level
518d65f6f70SBen GrasThe message level, printed in capital letters.
519d65f6f70SBen Gras.El
520d65f6f70SBen Gras.Pp
521d65f6f70SBen GrasMessage levels have the following meanings:
522d65f6f70SBen Gras.Bl -tag -width "warning"
523d65f6f70SBen Gras.It Cm fatal
524d65f6f70SBen GrasThe parser is unable to parse a given input file at all.
525d65f6f70SBen GrasNo formatted output is produced from that input file.
526d65f6f70SBen Gras.It Cm error
527d65f6f70SBen GrasAn input file contains syntax that cannot be safely interpreted,
528d65f6f70SBen Graseither because it is invalid or because
529d65f6f70SBen Gras.Nm
530d65f6f70SBen Grasdoes not implement it yet.
531d65f6f70SBen GrasBy discarding part of the input or inserting missing tokens,
532d65f6f70SBen Grasthe parser is able to continue, and the error does not prevent
533d65f6f70SBen Grasgeneration of formatted output, but typically, preparing that
534d65f6f70SBen Grasoutput involves information loss, broken document structure
535d65f6f70SBen Grasor unintended formatting.
536d65f6f70SBen Gras.It Cm warning
537d65f6f70SBen GrasAn input file uses obsolete, discouraged or non-portable syntax.
538d65f6f70SBen GrasAll the same, the meaning of the input is unambiguous and a correct
539d65f6f70SBen Grasrendering can be produced.
540d65f6f70SBen GrasDocuments causing warnings may render poorly when using other
541d65f6f70SBen Grasformatting tools instead of
542d65f6f70SBen Gras.Nm .
543d65f6f70SBen Gras.El
544d65f6f70SBen Gras.Pp
545d65f6f70SBen GrasMessages of the
546d65f6f70SBen Gras.Cm warning
547d65f6f70SBen Grasand
548d65f6f70SBen Gras.Cm error
549d65f6f70SBen Graslevels are hidden unless their level, or a lower level, is requested using a
550d65f6f70SBen Gras.Fl W
551d65f6f70SBen Grasoption or
552d65f6f70SBen Gras.Fl T Ns Cm lint
553d65f6f70SBen Grasoutput mode.
554d65f6f70SBen Gras.Pp
555d65f6f70SBen GrasThe
556d65f6f70SBen Gras.Nm
557d65f6f70SBen Grasutility may also print messages related to invalid command line arguments
558d65f6f70SBen Grasor operating system errors, for example when memory is exhausted or
559d65f6f70SBen Grasinput files cannot be read.
560d65f6f70SBen GrasSuch messages do not carry the prefix described above.
561d65f6f70SBen Gras.Sh COMPATIBILITY
562d65f6f70SBen GrasThis section summarises
563d65f6f70SBen Gras.Nm
564d65f6f70SBen Grascompatibility with GNU troff.
565d65f6f70SBen GrasEach input and output format is separately noted.
566d65f6f70SBen Gras.Ss ASCII Compatibility
567d65f6f70SBen Gras.Bl -bullet -compact
568d65f6f70SBen Gras.It
56992395e9cSLionel SambucUnrenderable unicode codepoints specified with
57092395e9cSLionel Sambuc.Sq \e[uNNNN]
57192395e9cSLionel Sambucescapes are printed as
57292395e9cSLionel Sambuc.Sq \&?
57392395e9cSLionel Sambucin mandoc.
57492395e9cSLionel SambucIn GNU troff, these raise an error.
57592395e9cSLionel Sambuc.It
576d65f6f70SBen GrasThe
577d65f6f70SBen Gras.Sq \&Bd \-literal
578d65f6f70SBen Grasand
579d65f6f70SBen Gras.Sq \&Bd \-unfilled
580d65f6f70SBen Grasmacros of
581d65f6f70SBen Gras.Xr mdoc 7
582d65f6f70SBen Grasin
583d65f6f70SBen Gras.Fl T Ns Cm ascii
584d65f6f70SBen Grasare synonyms, as are \-filled and \-ragged.
585d65f6f70SBen Gras.It
58692395e9cSLionel SambucIn historic GNU troff, the
587d65f6f70SBen Gras.Sq \&Pa
588d65f6f70SBen Gras.Xr mdoc 7
589d65f6f70SBen Grasmacro does not underline when scoped under an
590d65f6f70SBen Gras.Sq \&It
591d65f6f70SBen Grasin the FILES section.
592d65f6f70SBen GrasThis behaves correctly in
593d65f6f70SBen Gras.Nm .
594d65f6f70SBen Gras.It
595d65f6f70SBen GrasA list or display following the
596d65f6f70SBen Gras.Sq \&Ss
597d65f6f70SBen Gras.Xr mdoc 7
598d65f6f70SBen Grasmacro in
599d65f6f70SBen Gras.Fl T Ns Cm ascii
600d65f6f70SBen Grasdoes not assert a prior vertical break, just as it doesn't with
601d65f6f70SBen Gras.Sq \&Sh .
602d65f6f70SBen Gras.It
603d65f6f70SBen GrasThe
604d65f6f70SBen Gras.Sq \&na
605d65f6f70SBen Gras.Xr man 7
606d65f6f70SBen Grasmacro in
607d65f6f70SBen Gras.Fl T Ns Cm ascii
608d65f6f70SBen Grashas no effect.
609d65f6f70SBen Gras.It
610d65f6f70SBen GrasWords aren't hyphenated.
611d65f6f70SBen Gras.El
612d65f6f70SBen Gras.Ss HTML/XHTML Compatibility
613d65f6f70SBen Gras.Bl -bullet -compact
614d65f6f70SBen Gras.It
615d65f6f70SBen GrasThe
616d65f6f70SBen Gras.Sq \efP
617d65f6f70SBen Grasescape will revert the font to the previous
618d65f6f70SBen Gras.Sq \ef
619d65f6f70SBen Grasescape, not to the last rendered decoration, which is now dictated by
620d65f6f70SBen GrasCSS instead of hard-coded.
621d65f6f70SBen GrasIt also will not span past the current scope,
622d65f6f70SBen Grasfor the same reason.
623d65f6f70SBen GrasNote that in
624d65f6f70SBen Gras.Sx ASCII Output
625d65f6f70SBen Grasmode, this will work fine.
626d65f6f70SBen Gras.It
627d65f6f70SBen GrasThe
628d65f6f70SBen Gras.Xr mdoc 7
629d65f6f70SBen Gras.Sq \&Bl \-hang
630d65f6f70SBen Grasand
631d65f6f70SBen Gras.Sq \&Bl \-tag
632d65f6f70SBen Graslist types render similarly (no break following overreached left-hand
633d65f6f70SBen Grasside) due to the expressive constraints of HTML.
634d65f6f70SBen Gras.It
635d65f6f70SBen GrasThe
636d65f6f70SBen Gras.Xr man 7
637d65f6f70SBen Gras.Sq IP
638d65f6f70SBen Grasand
639d65f6f70SBen Gras.Sq TP
640d65f6f70SBen Graslists render similarly.
641d65f6f70SBen Gras.El
642d65f6f70SBen Gras.Sh SEE ALSO
64392395e9cSLionel Sambuc.Xr eqn 7 ,
644d65f6f70SBen Gras.Xr man 7 ,
645d65f6f70SBen Gras.Xr mandoc_char 7 ,
646d65f6f70SBen Gras.Xr mdoc 7 ,
647d65f6f70SBen Gras.Xr roff 7 ,
648d65f6f70SBen Gras.Xr tbl 7
649d65f6f70SBen Gras.Sh AUTHORS
650d65f6f70SBen GrasThe
651d65f6f70SBen Gras.Nm
652d65f6f70SBen Grasutility was written by
653*0a6a1f1dSLionel Sambuc.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
654d65f6f70SBen Gras.Sh CAVEATS
655d65f6f70SBen GrasIn
656d65f6f70SBen Gras.Fl T Ns Cm html
657d65f6f70SBen Grasand
658d65f6f70SBen Gras.Fl T Ns Cm xhtml ,
659d65f6f70SBen Grasthe maximum size of an element attribute is determined by
660d65f6f70SBen Gras.Dv BUFSIZ ,
661d65f6f70SBen Graswhich is usually 1024 bytes.
662d65f6f70SBen GrasBe aware of this when setting long link
663d65f6f70SBen Grasformats such as
664d65f6f70SBen Gras.Fl O Ns Cm style Ns = Ns Ar really/long/link .
665d65f6f70SBen Gras.Pp
666d65f6f70SBen GrasNesting elements within next-line element scopes of
667d65f6f70SBen Gras.Fl m Ns Cm an ,
668d65f6f70SBen Grassuch as
669d65f6f70SBen Gras.Sq br
670d65f6f70SBen Graswithin an empty
671d65f6f70SBen Gras.Sq B ,
672d65f6f70SBen Graswill confuse
673d65f6f70SBen Gras.Fl T Ns Cm html
674d65f6f70SBen Grasand
675d65f6f70SBen Gras.Fl T Ns Cm xhtml
676d65f6f70SBen Grasand cause them to forget the formatting of the prior next-line scope.
677d65f6f70SBen Gras.Pp
678d65f6f70SBen GrasThe
679d65f6f70SBen Gras.Sq \(aq
680d65f6f70SBen Grascontrol character is an alias for the standard macro control character
681d65f6f70SBen Grasand does not emit a line-break as stipulated in GNU troff.
682