xref: /freebsd/share/man/man5/style.mdoc.5 (revision 13bf4d9e880ed35c93c4abe1bf101d634d1318b8)
1*13bf4d9eSMateusz Piotrowski.\"
2*13bf4d9eSMateusz Piotrowski.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*13bf4d9eSMateusz Piotrowski.\"
4*13bf4d9eSMateusz Piotrowski.\" Copyright (c) 2018 Mateusz Piotrowski <0mp@FreeBSD.org>
5*13bf4d9eSMateusz Piotrowski.\"
6*13bf4d9eSMateusz Piotrowski.\" Redistribution and use in source and binary forms, with or without
7*13bf4d9eSMateusz Piotrowski.\" modification, are permitted provided that the following conditions
8*13bf4d9eSMateusz Piotrowski.\" are met:
9*13bf4d9eSMateusz Piotrowski.\" 1. Redistributions of source code must retain the above copyright
10*13bf4d9eSMateusz Piotrowski.\"    notice, this list of conditions and the following disclaimer.
11*13bf4d9eSMateusz Piotrowski.\" 2. Redistributions in binary form must reproduce the above copyright
12*13bf4d9eSMateusz Piotrowski.\"    notice, this list of conditions and the following disclaimer in the
13*13bf4d9eSMateusz Piotrowski.\"    documentation and/or other materials provided with the distribution.
14*13bf4d9eSMateusz Piotrowski.\"
15*13bf4d9eSMateusz Piotrowski.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*13bf4d9eSMateusz Piotrowski.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*13bf4d9eSMateusz Piotrowski.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*13bf4d9eSMateusz Piotrowski.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*13bf4d9eSMateusz Piotrowski.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*13bf4d9eSMateusz Piotrowski.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*13bf4d9eSMateusz Piotrowski.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*13bf4d9eSMateusz Piotrowski.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*13bf4d9eSMateusz Piotrowski.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*13bf4d9eSMateusz Piotrowski.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*13bf4d9eSMateusz Piotrowski.\" SUCH DAMAGE.
26*13bf4d9eSMateusz Piotrowski.\"
27*13bf4d9eSMateusz Piotrowski.\" $FreeBSD$
28*13bf4d9eSMateusz Piotrowski.\"
29*13bf4d9eSMateusz Piotrowski.Dd December 28, 2018
30*13bf4d9eSMateusz Piotrowski.Dt STYLE.MDOC 5
31*13bf4d9eSMateusz Piotrowski.Os
32*13bf4d9eSMateusz Piotrowski.Sh NAME
33*13bf4d9eSMateusz Piotrowski.Nm style.mdoc
34*13bf4d9eSMateusz Piotrowski.Nd
35*13bf4d9eSMateusz Piotrowski.Fx
36*13bf4d9eSMateusz Piotrowski.Xr mdoc 7
37*13bf4d9eSMateusz Piotrowskifile style guide
38*13bf4d9eSMateusz Piotrowski.Sh DESCRIPTION
39*13bf4d9eSMateusz PiotrowskiThis file specifies the preferred style for manual pages in the
40*13bf4d9eSMateusz Piotrowski.Fx
41*13bf4d9eSMateusz Piotrowskisource tree.
42*13bf4d9eSMateusz Piotrowski.Ss Code examples
43*13bf4d9eSMateusz Piotrowski.Bl -dash -width ""
44*13bf4d9eSMateusz Piotrowski.It
45*13bf4d9eSMateusz PiotrowskiUse literal formatting for examples and literal shell commands, e.g.:
46*13bf4d9eSMateusz Piotrowski.Bd -literal -offset indent
47*13bf4d9eSMateusz PiotrowskiThen run
48*13bf4d9eSMateusz Piotrowski\&.Dq Li make install clean .
49*13bf4d9eSMateusz Piotrowski.Ed
50*13bf4d9eSMateusz Piotrowski.Pp
51*13bf4d9eSMateusz Piotrowskiwhich renders as:
52*13bf4d9eSMateusz Piotrowski.Bd -filled -offset indent
53*13bf4d9eSMateusz PiotrowskiThen run
54*13bf4d9eSMateusz Piotrowski.Dq Li make install clean .
55*13bf4d9eSMateusz Piotrowski.Ed
56*13bf4d9eSMateusz Piotrowski.Pp
57*13bf4d9eSMateusz PiotrowskiThe incorrect way would be to use macros like
58*13bf4d9eSMateusz Piotrowski.Sy \&Nm
59*13bf4d9eSMateusz Piotrowskito stylize the command invocation:
60*13bf4d9eSMateusz Piotrowski.Bd -literal -offset indent
61*13bf4d9eSMateusz PiotrowskiThen run
62*13bf4d9eSMateusz Piotrowski\&.Dq Nm make Cm install Cm clean .
63*13bf4d9eSMateusz Piotrowski.Ed
64*13bf4d9eSMateusz Piotrowski.Pp
65*13bf4d9eSMateusz Piotrowskiwhich renders as:
66*13bf4d9eSMateusz Piotrowski.Bd -filled -offset indent
67*13bf4d9eSMateusz PiotrowskiThen run
68*13bf4d9eSMateusz Piotrowski.Dq Nm make Cm install Cm clean .
69*13bf4d9eSMateusz Piotrowski.Ed
70*13bf4d9eSMateusz Piotrowski.El
71*13bf4d9eSMateusz Piotrowski.Ss Synopsis formatting
72*13bf4d9eSMateusz Piotrowski.Bl -dash -width ""
73*13bf4d9eSMateusz Piotrowski.It
74*13bf4d9eSMateusz PiotrowskiDo not put whitespace between alternative parameters separated with a pipe
75*13bf4d9eSMateusz Piotrowski.Pq Dq | ,
76*13bf4d9eSMateusz Piotrowskie.g.:
77*13bf4d9eSMateusz Piotrowski.Bd -literal -offset indent
78*13bf4d9eSMateusz Piotrowski\&.Cm compression Cm on Ns | Ns Cm off
79*13bf4d9eSMateusz Piotrowski\&.Cm install Fl -all Ns | Ns Ar portname Ar ...
80*13bf4d9eSMateusz Piotrowski.Ed
81*13bf4d9eSMateusz Piotrowski.Pp
82*13bf4d9eSMateusz Piotrowskiwhich in the SYNOPSIS section is rendered as:
83*13bf4d9eSMateusz Piotrowski.Bd -unfilled -offset indent
84*13bf4d9eSMateusz Piotrowski.Cm compression Cm on Ns | Ns Cm off
85*13bf4d9eSMateusz Piotrowski.Cm install Fl -all Ns | Ns Ar portname Ar ...
86*13bf4d9eSMateusz Piotrowski.Ed
87*13bf4d9eSMateusz Piotrowski.It
88*13bf4d9eSMateusz PiotrowskiUse
89*13bf4d9eSMateusz Piotrowski.Sy \&Cm
90*13bf4d9eSMateusz Piotrowskito stylize characters that are command modifiers
91*13bf4d9eSMateusz Piotrowski.Po e.g.,
92*13bf4d9eSMateusz Piotrowski.Dq \&, ,
93*13bf4d9eSMateusz Piotrowski.Dq @
94*13bf4d9eSMateusz Piotrowskior
95*13bf4d9eSMateusz Piotrowski.Dq "="
96*13bf4d9eSMateusz Piotrowski.Pc .
97*13bf4d9eSMateusz PiotrowskiFor example:
98*13bf4d9eSMateusz Piotrowski.Bd -literal -offset indent
99*13bf4d9eSMateusz Piotrowski\&.Sm off
100*13bf4d9eSMateusz Piotrowski\&.Fl -meet Cm = Ar who Oo Cm \&, Ar who " " Ar "..." Oc Cm @ Ar where
101*13bf4d9eSMateusz Piotrowski\&.Sm on
102*13bf4d9eSMateusz Piotrowski.Ed
103*13bf4d9eSMateusz Piotrowski.Pp
104*13bf4d9eSMateusz Piotrowskiwhich renders as:
105*13bf4d9eSMateusz Piotrowski.Bd -filled -offset indent
106*13bf4d9eSMateusz Piotrowski.Sm off
107*13bf4d9eSMateusz Piotrowski.Fl -meet Cm = Ar who Oo Cm \&, Ar who " " Ar "..." Oc Cm @ Ar where
108*13bf4d9eSMateusz Piotrowski.Sm on
109*13bf4d9eSMateusz Piotrowski.Ed
110*13bf4d9eSMateusz Piotrowski.Pp
111*13bf4d9eSMateusz Piotrowskiinstead of:
112*13bf4d9eSMateusz Piotrowski.Bd -literal -offset indent
113*13bf4d9eSMateusz Piotrowski\&.Sm off
114*13bf4d9eSMateusz Piotrowski\&.Fl -meet No = Ar who Oo , Ar who " " Ar "..." Oc @ Ar where
115*13bf4d9eSMateusz Piotrowski\&.Sm on
116*13bf4d9eSMateusz Piotrowski.Ed
117*13bf4d9eSMateusz Piotrowski.Pp
118*13bf4d9eSMateusz Piotrowskiwhich would render as:
119*13bf4d9eSMateusz Piotrowski.Bd -filled -offset indent
120*13bf4d9eSMateusz Piotrowski.Sm off
121*13bf4d9eSMateusz Piotrowski.Fl -meet No = Ar who Oo , Ar who " " Ar "..." Oc @ Ar where
122*13bf4d9eSMateusz Piotrowski.Sm on
123*13bf4d9eSMateusz Piotrowski.Ed
124*13bf4d9eSMateusz Piotrowski.Pp
125*13bf4d9eSMateusz PiotrowskiIt is important to realize that in the correct example,
126*13bf4d9eSMateusz Piotrowski.Dq \&, ,
127*13bf4d9eSMateusz Piotrowski.Dq @
128*13bf4d9eSMateusz Piotrowskiand
129*13bf4d9eSMateusz Piotrowski.Dq =
130*13bf4d9eSMateusz Piotrowskiare stylized with
131*13bf4d9eSMateusz Piotrowski.Sy \&Cm .
132*13bf4d9eSMateusz PiotrowskiAt the same time, the square brackets
133*13bf4d9eSMateusz Piotrowski.Pq Dq "[]"
134*13bf4d9eSMateusz Piotrowskiare not stylized as they do not belong to the syntax of the
135*13bf4d9eSMateusz Piotrowski.Fl -meet
136*13bf4d9eSMateusz Piotrowskiflag.
137*13bf4d9eSMateusz Piotrowski.El
138*13bf4d9eSMateusz Piotrowski.Ss Quoting
139*13bf4d9eSMateusz Piotrowski.Bl -dash -width ""
140*13bf4d9eSMateusz Piotrowski.It
141*13bf4d9eSMateusz PiotrowskiUse the
142*13bf4d9eSMateusz Piotrowski.Sy \&Dq
143*13bf4d9eSMateusz Piotrowski.Pq Do Dc
144*13bf4d9eSMateusz Piotrowskimacro
145*13bf4d9eSMateusz Piotrowskifor quoting.
146*13bf4d9eSMateusz PiotrowskiUse the
147*13bf4d9eSMateusz Piotrowski.Sy \&Sq
148*13bf4d9eSMateusz Piotrowski.Pq So Sc
149*13bf4d9eSMateusz Piotrowskimacro for quoting inside quotes.
150*13bf4d9eSMateusz PiotrowskiThe use of the
151*13bf4d9eSMateusz Piotrowski.Sy \&Qq
152*13bf4d9eSMateusz Piotrowski.Pq Qo Qc
153*13bf4d9eSMateusz Piotrowskimacro is usually not necessary.
154*13bf4d9eSMateusz Piotrowski.El
155*13bf4d9eSMateusz Piotrowski.Ss Variables
156*13bf4d9eSMateusz Piotrowski.Bl -dash -width ""
157*13bf4d9eSMateusz Piotrowski.It
158*13bf4d9eSMateusz PiotrowskiUse
159*13bf4d9eSMateusz Piotrowski.Sy \&Va
160*13bf4d9eSMateusz Piotrowskiinstead of:
161*13bf4d9eSMateusz Piotrowski.Sy \&Dv
162*13bf4d9eSMateusz Piotrowskifor
163*13bf4d9eSMateusz Piotrowski.Xr sysctl 8
164*13bf4d9eSMateusz Piotrowskivariables like
165*13bf4d9eSMateusz Piotrowski.Va kdb.enter.panic .
166*13bf4d9eSMateusz Piotrowski.It
167*13bf4d9eSMateusz PiotrowskiUse the angle brackets
168*13bf4d9eSMateusz Piotrowski.Sy \&Aq
169*13bf4d9eSMateusz Piotrowski.Pq Dq "<>"
170*13bf4d9eSMateusz Piotrowskimacro
171*13bf4d9eSMateusz Piotrowskifor arguments
172*13bf4d9eSMateusz Piotrowski.Pq Sy \&Ar
173*13bf4d9eSMateusz Piotrowskiwhen they are mixed with similarly stylized macros like
174*13bf4d9eSMateusz Piotrowski.Sy \&Pa
175*13bf4d9eSMateusz Piotrowskior
176*13bf4d9eSMateusz Piotrowski.Sy \&Va ,
177*13bf4d9eSMateusz Piotrowskie.g.:
178*13bf4d9eSMateusz Piotrowski.Bd -literal -offset indent
179*13bf4d9eSMateusz Piotrowski\&.Va critical_filesystems_ Ns Aq Ar type
180*13bf4d9eSMateusz Piotrowski.Ed
181*13bf4d9eSMateusz Piotrowski.Pp
182*13bf4d9eSMateusz Piotrowskiwhich renders as:
183*13bf4d9eSMateusz Piotrowski.Bd -filled -offset indent
184*13bf4d9eSMateusz Piotrowski.Va critical_filesystems_ Ns Aq Ar type
185*13bf4d9eSMateusz Piotrowski.Ed
186*13bf4d9eSMateusz Piotrowski.Pp
187*13bf4d9eSMateusz Piotrowskiinstead of:
188*13bf4d9eSMateusz Piotrowski.Bd -literal -offset indent
189*13bf4d9eSMateusz Piotrowski\&.Va critical_filesystems_ Ns Ar type
190*13bf4d9eSMateusz Piotrowski.Ed
191*13bf4d9eSMateusz Piotrowski.Pp
192*13bf4d9eSMateusz Piotrowskithat would be rendered as:
193*13bf4d9eSMateusz Piotrowski.Bd -filled -offset indent
194*13bf4d9eSMateusz Piotrowski.Va critical_filesystems_ Ns Ar type
195*13bf4d9eSMateusz Piotrowski.Ed
196*13bf4d9eSMateusz Piotrowski.El
197*13bf4d9eSMateusz Piotrowski.Sh SEE ALSO
198*13bf4d9eSMateusz Piotrowski.Xr man 1 ,
199*13bf4d9eSMateusz Piotrowski.Xr mandoc 1 ,
200*13bf4d9eSMateusz Piotrowski.Xr mdoc 7
201*13bf4d9eSMateusz Piotrowski.Sh HISTORY
202*13bf4d9eSMateusz PiotrowskiThis manual page first appeared in
203*13bf4d9eSMateusz Piotrowski.Fx 13.0 .
204*13bf4d9eSMateusz Piotrowski.Sh AUTHORS
205*13bf4d9eSMateusz Piotrowski.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org
206