STYLE.MDOC(5)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸŽ€ so you wanna write a FreeBSD man page πŸŽ€

okay bestie, welcome to style.mdoc(5) β€” the FreeBSD manual page style guide, straight out of the File Formats Manual section. this is the whole vibe check for how man pages in the FreeBSD source tree are supposed to look ✨

✨ DESCRIPTION ✨

this file spells out the preferred style for manual pages in the FreeBSD source tree. that's it, that's the assignment 🫢

πŸ’… Code Examples πŸ’…

  • use literal formatting for examples and literal shell commands, like this:
Then run
.Ql make install clean .

which renders as:

Then run β€˜make install clean’.

the incorrect way would be reaching for macros like Nm to stylize the command invocation:

Then run
.Ql Nm make Cm install Cm clean .

which renders as:

Then run β€˜make install clean’.

(yes bestie, same render, different crime β€” don't do the macro one πŸ™ˆ)

go refer to style(9). that's it. that's the whole note πŸ”₯

🌸 HARDWARE Section 🌸

driver manuals in section four should have a β€œHARDWARE” section describing hardware known to work with the driver. this section is drawn verbatim into the Release Hardware Notes, so there's several things to note πŸ‘‘

  • the introductory sentence should be in the form:
The
.Nm
driver supports the following $device_class:

followed by the list of supported hardware.

this defines what driver the subsection is referring to, and lets the reader search through the Hardware Notes not only for the device models they have, but also for the device type they're looking to acquire. iykyk πŸ’–

  • the supported hardware should be listed as a bullet list, or β€” if complexity requires it β€” a column list. these two list types create very neat subsections with clean starting and stopping points. iconic behaviour, honestly ⭐

πŸ¦‹ EXAMPLES Section πŸ¦‹

  • format the β€œEXAMPLES” section in the following way:
.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

which renders as:

Example 1: Doing Something

  The following command does something.

    # make -VLEGAL

Example 2: Doing Something Different

  The following command does something different.

    # bectl list

  It is good to know this command.

look at that structure. immaculate. no notes πŸ’…

🌈 Lists 🌈

  • the -width argument to the .Bl macro should match the length of the longest rendered item in the list, e.g.:
.Bl -tag -width "-a address"
.It Fl a Ar address
Set the address.
.It Fl v
Print the version.
.El

in case the longest item is too long and hurts readability, the recommendation is to set the -width argument to β€˜indent’, e.g.:

.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

matching widths = main character energy. unmatched widths = chaos 😭

πŸ“ Quoting πŸ“

  • use the Dq (β€œβ€) macro for quoting. use the Sq (β€˜β€™) macro for quoting inside quotes. the use of the Qq ("") macro is usually not necessary. that's the whole hierarchy, bestie πŸ‘‘

πŸ’œ Variables πŸ’œ

  • use Va instead of Dv for sysctl(8) variables like kdb.enter.panic.
  • use the angle brackets Aq (β€œβŸ¨βŸ©β€) macro for arguments (Ar) when they're mixed with similarly stylized macros like Pa or Va, e.g.:
.Va critical_filesystems_ Ns Aq Ar type

which renders as:

critical_filesystems_⟨type⟩

instead of:

.Va critical_filesystems_ Ns Ar type

that would be rendered as:

critical_filesystems_type

see the difference? the brackets are eating, and the plain one is lowkey giving nothing. use the Aq ✨


πŸ“ FILES πŸ“

  • /usr/share/examples/mdoc/ β€” Examples for writing manual pages. go peek, it's free real estate πŸŽ€

πŸ‘€ SEE ALSO πŸ‘€

man(1), mandoc(1), mdoc(7), roff(7), style(9)

πŸ•°οΈ HISTORY πŸ•°οΈ

this manual page first appeared in FreeBSD 13.0. a modern icon, fr fr 🌟

🫢 AUTHORS 🫢

Mateusz Piotrowski <0mp@FreeBSD.org> β€” thank you for your service, king πŸ‘‘


and that's the whole style guide, bestie β€” go forth and format πŸ’–

this lil rendering of the page came from the Debian build, dated February 16, 2025 β€” so if u see this in the wild, that's who's serving it to u πŸ¦‹

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ“œ the page's license: BSD-2-Clause
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms