.\" .\" 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