summaryrefslogtreecommitdiff
path: root/static/freebsd/man5/style.mdoc.5
blob: 64e2291d1c75c795765a52080e4e843b5e70a184 (plain)
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
.\"
.\" Copyright (c) 2018-2025 Mateusz Piotrowski <0mp@FreeBSD.org>
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.Dd February 16, 2025
.Dt STYLE.MDOC 5
.Os
.Sh NAME
.Nm style.mdoc
.Nd FreeBSD 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
.El
.Ss Copyright Header
Refer to
.Xr style 9 .
.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 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 Ao Ac
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 FILES
.Bl -tag -width "/usr/share/examples/mdoc/tab"
.It /usr/share/examples/mdoc/
Examples for writing manual pages.
.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