---
name: "style.mdoc"
section: "5"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/style.mdoc"
---

# style.mdoc(5)

FreeBSD manual page style guide

## NAME

**style.mdoc** – FreeBSD manual page style guide

## DESCRIPTION

This file specifies the preferred style for manual pages in the FreeBSD source tree.

### NAME Section

- Do not quote the document description provided to the **.Nd** macro.

### Code Examples

- Use literal formatting for examples and literal shell commands, e.g.:

  ```
  Then run
  .Ql make install clean .
  ```

  which renders as:

  Then run ‘make install clean’.

  The incorrect way would be to use 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**’.

  This pollutes the [whatis(1)](/whatis/1.md) database, causing ‘whatis clean’ to incorrectly show the page it was written in.

### Copyright Header

Refer to [style(9)](/style/9.md).

### 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, therefore there are 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 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.

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

### 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.

### 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
  ```

### 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.

### Variables

- Use **Va** instead of **Dv** for [sysctl(8)](/sysctl/8.md) variables like *kdb.enter.panic*.

- Use the angle brackets **Aq** (“⟨⟩”) macro for arguments (**Ar**) when they are 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*

## FILES

- /usr/share/examples/mdoc/

  Examples for writing manual pages.

## SEE ALSO

[man(1)](/man/1.md), [mandoc(1)](/mandoc/1.md), [mdoc(7)](/mdoc/7.md), [roff(7)](/roff/7.md), [style(9)](/style/9.md)

## HISTORY

This manual page first appeared in FreeBSD 13.0.

## AUTHORS

Mateusz Piotrowski ⟨*0mp@FreeBSD.org*⟩
