aboutsummaryrefslogtreecommitdiff
path: root/share/man/man5/style.mdoc.5
blob: d96c9ff08bbbd73674d5709ad35c1e85d5ae919b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2022 Mateusz Piotrowski <0mp@FreeBSD.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd December 21, 2024
.Dt STYLE.MDOC 5
.Os
.Sh NAME
.Nm style.mdoc
.Nd
.Fx
.Xr mdoc 7
manual page style guide
.Sh DESCRIPTION
This file specifies the preferred style for manual pages in the
.Fx
source tree.
.Ss Code Examples
.Bl -dash -width ""
.It
Use literal formatting for examples and literal shell commands, e.g.:
.Bd -literal -offset indent
Then run
\&.Ql make install clean .
.Ed
.Pp
which renders as:
.Bd -filled -offset indent
Then run
.Ql make install clean .
.Ed
.Pp
The incorrect way would be to use macros like
.Sy \&Nm
to stylize the command invocation:
.Bd -literal -offset indent
Then run
\&.Ql Nm make Cm install Cm clean .
.Ed
.Pp
which renders as:
.Bd -filled -offset indent
Then run
.Ql Nm make Cm install Cm clean .
.Ed
.It
The
.Sy \&Ql
macro is the preferred macro for formatting literal inline fragments.
Historically,
.Sy \&Dq \&Li
was the preferred way before the deprecation of
.Sy \&Li .
.El
.Ss HARDWARE Section
Driver manuals in section four should have a
.Sx HARDWARE
section describing hardware known to work with the driver.
This section is drawn verbatim into the Release Hardware Notes,
therefore there are several things to note:
.Bl -dash -width ""
.It
The introductory sentence should be in the form:
.Bd -literal -offset indent
The
\&.Nm
driver supports the following $device_class:
.Ed
.Pp
Followed by the list of supported hardware.
.Pp
This defines what driver the subsection is referring to,
and allows the reader to search through the Hardware Notes
not only for the device models they have,
but also for the device type they are looking to acquire.
.It
The supported hardware should be listed as a bullet list,
or if complexity requires, a column list.
These two list types create very neat subsections
with clean starting and stopping points.
.El
.Ss EXAMPLES Section
.Bl -dash -width ""
.It
Format the
.Sx EXAMPLES
section in the following way:
.Bd -literal -offset indent
\&.Bl -tag -width 0n
\&.It Sy Example 1\\&: Doing Something
\&.Pp
The following command does something.
\&.Bd -literal -offset 2n
\&.Ic # make -VLEGAL
\&.Ed
\&.It Sy Example 2\\&: Doing Something Different
\&.Pp
The following command does something different.
\&.Bd -literal -offset 2n
\&.Ic # bectl list
\&.Ed
\&.Pp
It is good to know this command.
\&.El
.Ed
.Pp
which renders as:
.Bl -tag -width 0n
.It Sy Example 1\&: Doing Something
.Pp
The following command does something.
.Bd -literal -offset 2n
.Ic # make -VLEGAL
.Ed
.It Sy Example 2\&: Doing Something Different
.Pp
The following command does something different.
.Bd -literal -offset 2n
.Ic # bectl list
.Ed
.Pp
It is good to know this command.
.El
.El
.Ss Lists
.Bl -dash -width ""
.It
The
.Fl width
argument to the
.Sy \&.Bl
macro should match the length of the longest rendered item in the list,
e.g.:
.Bd -literal -offset indent
\&.Bl -tag -width "-a address"
\&.It Fl a Ar address
Set the address.
\&.It Fl v
Print the version.
\&.El
.Ed
.Pp
In case the longest item is too long and hurts readability,
the recommendation is to set
the
.Fl width
argument
to
.Ql indent ,
e.g.:
.Bd -literal -offset indent
\&.Bl -tag -width "indent"
\&.It Cm build
Build the port.
\&.It Cm install
Install the port.
\&.It Fl install-missing-packages
Install the missing packages.
\&.El
.Ed
.El
.Ss Synopsis Formatting
.Bl -dash -width ""
.It
Do not put whitespace between alternative parameters separated with a pipe
.Pq Dq | ,
e.g.:
.Bd -literal -offset indent
\&.Cm compression Cm on Ns | Ns Cm off
\&.Cm install Fl -all Ns | Ns Ar portname Ar ...
.Ed
.Pp
which in the SYNOPSIS section is rendered as:
.Bd -unfilled -offset indent
.Cm compression Cm on Ns | Ns Cm off
.Cm install Fl -all Ns | Ns Ar portname Ar ...
.Ed
.It
Use
.Sy \&Cm
to stylize characters that are command modifiers
.Po e.g.,
.Dq \&, ,
.Dq @
or
.Dq "="
.Pc .
For example:
.Bd -literal -offset indent
\&.Sm off
\&.Fl -meet Cm = Ar who Oo Cm \&, Ar who " " Ar "..." Oc Cm @ Ar where
\&.Sm on
.Ed
.Pp
which renders as:
.Bd -filled -offset indent
.Sm off
.Fl -meet Cm = Ar who Oo Cm \&, Ar who " " Ar "..." Oc Cm @ Ar where
.Sm on
.Ed
.Pp
instead of:
.Bd -literal -offset indent
\&.Sm off
\&.Fl -meet No = Ar who Oo , Ar who " " Ar "..." Oc @ Ar where
\&.Sm on
.Ed
.Pp
which would render as:
.Bd -filled -offset indent
.Sm off
.Fl -meet No = Ar who Oo , Ar who " " Ar "..." Oc @ Ar where
.Sm on
.Ed
.Pp
It is important to realize that in the correct example,
.Dq \&, ,
.Dq @
and
.Dq =
are stylized with
.Sy \&Cm .
At the same time, the square brackets
.Pq Dq "[]"
are not stylized as they do not belong to the syntax of the
.Fl -meet
flag.
.El
.Ss Quoting
.Bl -dash -width ""
.It
Use the
.Sy \&Dq
.Pq Do Dc
macro
for quoting.
Use the
.Sy \&Sq
.Pq So Sc
macro for quoting inside quotes.
The use of the
.Sy \&Qq
.Pq Qo Qc
macro is usually not necessary.
.El
.Ss Variables
.Bl -dash -width ""
.It
Use
.Sy \&Va
instead of
.Sy \&Dv
for
.Xr sysctl 8
variables like
.Va kdb.enter.panic .
.It
Use the angle brackets
.Sy \&Aq
.Pq Dq "<>"
macro
for arguments
.Pq Sy \&Ar
when they are mixed with similarly stylized macros like
.Sy \&Pa
or
.Sy \&Va ,
e.g.:
.Bd -literal -offset indent
\&.Va critical_filesystems_ Ns Aq Ar type
.Ed
.Pp
which renders as:
.Bd -filled -offset indent
.Va critical_filesystems_ Ns Aq Ar type
.Ed
.Pp
instead of:
.Bd -literal -offset indent
\&.Va critical_filesystems_ Ns Ar type
.Ed
.Pp
that would be rendered as:
.Bd -filled -offset indent
.Va critical_filesystems_ Ns Ar type
.Ed
.El
.Sh SEE ALSO
.Xr man 1 ,
.Xr mandoc 1 ,
.Xr mdoc 7 ,
.Xr roff 7 ,
.Xr style 9
.Sh HISTORY
This manual page first appeared in
.Fx 13.0 .
.Sh AUTHORS
.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org