NAME
mdoc — semantic markup language for formatting manual pagesDESCRIPTION
The mdoc language supports authoring of manual pages for the man(1) utility by allowing semantic annotations of words, phrases, page sections and complete manual pages. Such annotations are used by formatting tools to achieve a uniform presentation across all manuals written in mdoc, and to support hyperlinking if supported by the output medium..Sh Macro lines change control state. Text lines are interpreted within the current state.
MANUAL STRUCTURE
A well-formed mdoc document consists of a document prologue followed by one or more sections..Dd $Mdocdate$ .Dt PROGNAME section .Os .Sh NAME .Nm progname .Nd one line about what it does .\" .Sh LIBRARY .\" For sections 2, 3, and 9 only. .\" Not used in OpenBSD. .Sh SYNOPSIS .Nm progname .Op Fl options .Ar .Sh DESCRIPTION The .Nm utility processes files ... .\" .Sh CONTEXT .\" For section 9 functions only. .\" .Sh IMPLEMENTATION NOTES .\" Not used in OpenBSD. .\" .Sh RETURN VALUES .\" For sections 2, 3, and 9 function return values only. .\" .Sh ENVIRONMENT .\" For sections 1, 6, 7, and 8 only. .\" .Sh FILES .\" .Sh EXIT STATUS .\" For sections 1, 6, and 8 only. .\" .Sh EXAMPLES .\" .Sh DIAGNOSTICS .\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. .\" .Sh ERRORS .\" For sections 2, 3, 4, and 9 errno settings only. .\" .Sh SEE ALSO .\" .Xr foobar 1 .\" .Sh STANDARDS .\" .Sh HISTORY .\" .Sh AUTHORS .\" .Sh CAVEATS .\" .Sh BUGS .\" .Sh SECURITY CONSIDERATIONS .\" Not used in OpenBSD.
- NAME
-
The name(s) and a one line description of the documented material. The syntax for this as follows:
.Nm name0 , .Nm name1 , .Nm name2 .Nd a one line description
- LIBRARY
-
The name of the library containing the documented material, which is assumed to be a function in a section 2, 3, or 9 manual. The syntax for this is as follows:
.Lb libarm
- SYNOPSIS
-
Documents the utility invocation syntax, function call syntax, or device configuration.
.Nm bar .Op Fl v .Op Fl o Ar file .Op Ar .Nm foo .Op Fl v .Op Fl o Ar file .Op Ar
.In header.h .Vt extern const char *global; .Ft "char *" .Fn foo "const char *src" .Ft "char *" .Fn bar "const char *src"
.Cd "it* at isa? port 0x2e" .Cd "it* at isa? port 0x4e"
- DESCRIPTION
-
This begins with an expansion of the brief, one line description in NAME:
The .Nm utility does this, that, and the other.
The arguments are as follows: .Bl -tag -width Ds .It Fl v Print verbose information. .El
- CONTEXT
- This section lists the contexts in which functions can be called in section 9. The contexts are autoconf, process, or interrupt.
- IMPLEMENTATION NOTES
- Implementation-specific notes should be kept here. This is useful when implementing standard functions that may have side effects or notable algorithmic implications.
- RETURN VALUES
-
This section documents the return values of functions in sections 2, 3, and 9.
- ENVIRONMENT
-
Lists the environment variables used by the utility, and explains the syntax and semantics of their values. The environ(7) manual provides examples of typical content and formatting.
- FILES
-
Documents files used. It's helpful to document both the file name and a short description of how the file is used (created, modified, etc.).
- EXIT STATUS
-
This section documents the command exit status for section 1, 6, and 8 utilities. Historically, this information was described in DIAGNOSTICS, a practise that is now discouraged.
- EXAMPLES
- Example usages. This often contains snippets of well-formed, well-tested invocations. Make sure that examples work properly!
- DIAGNOSTICS
-
Documents error messages. In section 4 and 9 manuals, these are usually messages printed by the kernel to the console and to the kernel log. In section 1, 6, 7, and 8, these are usually messages printed by userland programs to the standard error output.
- ERRORS
-
Documents errno(2) settings in sections 2, 3, 4, and 9.
- SEE ALSO
-
References other manuals with related topics. This section should exist for most manuals. Cross-references should conventionally be ordered first by section, then alphabetically (ignoring case).
- STANDARDS
-
References any standards implemented or used. If not adhering to any standards, the HISTORY section should be used instead.
- HISTORY
- A brief history of the subject, including where it was first implemented, and when it was ported to or reimplemented for the operating system at hand.
- AUTHORS
-
Credits to the person or persons who wrote the code and/or documentation. Authors should generally be noted by both name and email address.
- CAVEATS
- Common misuses and misunderstandings should be explained in this section.
- BUGS
- Known bugs, limitations, and work-arounds should be described in this section.
- SECURITY CONSIDERATIONS
- Documents any security precautions that operators should consider.
MACRO OVERVIEW
This overview is sorted such that macros of similar purpose are listed together, to help find the best macro for any given purpose. Deprecated macros are not included in the overview, but can be found below in the alphabetical MACRO REFERENCE.Document preamble and NAME section macros
Dd | document date: $Mdocdate$ | month day, year |
Dt | document title: TITLE section [arch] |
Os | operating system version: [system [version]] |
Nm | document name (one argument) |
Nd | document description (one line) |
Sections and cross references
Sh | section header (one line) |
Ss | subsection header (one line) |
Sx | internal cross reference to a section or subsection |
Xr | cross reference to another manual page: name section |
Pp, Lp | start a text paragraph (no arguments) |
Displays and lists
Bd, Ed | display block: -type [-offset width] [-compact] |
D1 | indented display (one line) |
Dl | indented literal display (one line) |
Ql |
in-line literal display: ‘text ’ |
Bl, El | list block: -type [-width val] [-offset val] [-compact] |
It | list item (syntax depends on -type) |
Ta |
table cell separator in Bl -column lists |
Rs, %*, Re | bibliographic block (references) |
Spacing control
Pf | prefix, no following horizontal space (one argument) |
Ns | roman font, no preceding horizontal space (no arguments) |
Ap | apostrophe without surrounding whitespace (no arguments) |
Sm | switch horizontal spacing mode: [on | off] |
Bk, Ek | keep block: -words |
br | force output line break in text mode (no arguments) |
sp | force vertical space: [height] |
Semantic markup for command line utilities:
Nm | start a SYNOPSIS block with the name of a utility |
Fl | command line options (flags) (>=0 arguments) |
Cm | command modifier (>0 arguments) |
Ar | command arguments (>=0 arguments) |
Op, Oo, Oc | optional syntax elements (enclosure) |
Ic | internal or interactive command (>0 arguments) |
Ev | environmental variable (>0 arguments) |
Pa | file system path (>=0 arguments) |
Semantic markup for function libraries:
Lb | function library (one argument) |
In | include file (one argument) |
Fd | other preprocessor directive (>0 arguments) |
Ft | function type (>0 arguments) |
Fo, Fc | function block: funcname |
Fn | function name: [functype] funcname [[argtype] argname] |
Fa | function argument (>0 arguments) |
Vt | variable type (>0 arguments) |
Va | variable name (>0 arguments) |
Dv | defined variable or preprocessor constant (>0 arguments) |
Er | error constant (>0 arguments) |
Ev | environmental variable (>0 arguments) |
Various semantic markup:
An | author name (>0 arguments) |
Lk | hyperlink: uri [name] |
Mt | “mailto” hyperlink: address |
Cd | kernel configuration declaration (>0 arguments) |
Ad | memory address (>0 arguments) |
Ms | mathematical symbol (>0 arguments) |
Physical markup
Em | italic font or underline (emphasis) (>0 arguments) |
Sy | boldface font (symbolic) (>0 arguments) |
Li | typewriter font (literal) (>0 arguments) |
No | return to roman font (normal) (no arguments) |
Bf, Ef | font block: [-type | Em | Li | Sy] |
Physical enclosures
Dq, Do, Dc | enclose in typographic double quotes: “text” |
Qq, Qo, Qc | enclose in typewriter double quotes: “text” |
Sq, So, Sc | enclose in single quotes: ‘text’ |
Pq, Po, Pc | enclose in parentheses: (text) |
Bq, Bo, Bc | enclose in square brackets: [text] |
Brq, Bro, Brc | enclose in curly braces: {text} |
Aq, Ao, Ac | enclose in angle brackets: ⟨text⟩ |
Eo, Ec | generic enclosure |
MACRO REFERENCE
This section is a canonical reference of all macros, arranged alphabetically. For the scoping of individual macros, see MACRO SYNTAX.%A
Author name of an Rs block. Multiple authors should each be accorded their own %A line. Author names should be ordered with full or abbreviated forename(s) first, then full surname.%B
Book title of an Rs block. This macro may also be used in a non-bibliographic context when referring to book titles.%D
Publication date of an Rs block. Recommended formats of arguments are month day, year or just year.%Q
Institutional author (school, government, etc.) of an Rs block. Multiple institutional authors should each be accorded their own %Q line.%T
Article title of an Rs block. This macro may also be used in a non-bibliographical context when referring to article titles.%U
URI of reference document.An
Author name. Can be used both for the authors of the program, function, or driver documented in the manual, or for the authors of the manual itself. Requires either the name of an author or one of the following arguments:- -split
- Start a new output line before each subsequent invocation of An.
- -nosplit
- The opposite of -split.
.An -nosplit
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
Ao
Begin a block enclosed by angle brackets. Does not have any head arguments..Fl -key= Ns Ao Ar val Ac
Ap
Inserts an apostrophe without any surrounding whitespace. This is generally used as a grammatical device when referring to the verb form of a function..Fn execve Ap d
Aq
Encloses its arguments in angle brackets..Fl -key= Ns Aq Ar val
#include
” statements, which should use In.Ar
Command arguments. If an argument is not provided, the string “file ...” is used as a default..Fl o Ar file
.Ar
.Ar arg1 , arg2 .
At
Formats an AT&T UNIX version. Accepts one optional argument:- v[1-7] | 32v
- A version of AT&T UNIX.
- III
- AT&T System III UNIX.
- V[.[1-4]]?
- A version of AT&T System V UNIX.
.At
.At III
.At V.1
Bd
Begin a display block. Its syntax is as follows:- -centered
- Produce one output line from each input line, and center-justify each line. Using this display type is not recommended; many mdoc implementations render it poorly.
- -filled
- Change the positions of line breaks to fill each line, and left- and right-justify the resulting block.
- -literal
- Produce one output line from each input line, and do not justify the block at all. Preserve white space as it appears in the input. Always use a constant-width font. Use this for displaying source code.
- -ragged
- Change the positions of line breaks to fill each line, and left-justify the resulting block.
- -unfilled
- The same as -literal, but using the same font as for normal text, which is a variable width font if supported by the output device.
- -offset width
-
Indent the display by the width, which may be one of the following:
- One of the pre-defined strings indent, the width of a standard indentation (six constant width characters); indent-two, twice indent; left, which has no effect; right, which justifies to the right margin; or center, which aligns around an imagined center axis.
- A macro invocation, which selects a predefined width associated with that macro. The most popular is the imaginary macro Ds, which resolves to 6n.
- A scaling width as described in roff(7).
- An arbitrary string, which indents by the length of this string.
- -compact
- Do not assert vertical space before the display.
.Bd -literal -offset indent -compact Hello world. .Ed
Bf
Change the font mode for a scoped block of text. Its syntax is as follows:
.Bf [-emphasis | -literal | -symbolic | Em | Li | Sy]
Bk
For each macro, keep its output together on the same output line, until the end of the macro or the end of the input line is reached, whichever comes first. Line breaks in text lines are unaffected. The syntax is as follows:.Bk -words
.Bk -words .Op Fl f Ar flags .Op Fl o Ar output .Ek
Bl
Begin a list. Lists consist of items specified using the It macro, containing a head or a body or both. The list syntax is as follows:- -bullet
- No item heads can be specified, but a bullet will be printed at the head of each item. Item bodies start on the same output line as the bullet and are indented according to the -width argument.
- -column
- A columnated list. The -width argument has no effect; instead, each argument specifies the width of one column, using either the scaling width syntax described in roff(7) or the string length of the argument. If the first line of the body of a -column list is not an It macro line, It contexts spanning one input line each are implied until an It macro line is encountered, at which point items start being interpreted as described in the It documentation.
- -dash
- Like -bullet, except that dashes are used in place of bullets.
- -diag
- Like -inset, except that item heads are not parsed for macro invocations. Most often used in the DIAGNOSTICS section with error constants in the item heads.
- -enum
- A numbered list. No item heads can be specified. Formatted like -bullet, except that cardinal numbers are used in place of bullets, starting at 1.
- -hang
- Like -tag, except that the first lines of item bodies are not indented, but follow the item heads like in -inset lists.
- -hyphen
- Synonym for -dash.
- -inset
- Item bodies follow items heads on the same line, using normal inter-word spacing. Bodies are not indented, and the -width argument is ignored.
- -item
- No item heads can be specified, and none are printed. Bodies are not indented, and the -width argument is ignored.
- -ohang
- Item bodies start on the line following item heads and are not indented. The -width argument is ignored.
- -tag
- Item bodies are indented according to the -width argument. When an item head fits inside the indentation, the item body follows this head on the same output line. Otherwise, the body starts on the output line following the head.
Bo
Begin a block enclosed by square brackets. Does not have any head arguments..Bo 1 , .Dv BUFSIZ Bc
Bq
Encloses its arguments in square brackets..Bq 1, Dv BUFSIZ
Bro
Begin a block enclosed by curly braces. Does not have any head arguments..Bro 1 , ... , .Va n Brc
Bsx
Format the BSD/OS version provided as an argument, or a default value if no argument is provided..Bsx 1.0
.Bsx
Bt
Supported only for compatibility, do not use this in new manuals. Prints “is currently in beta test.”Bx
Format the BSD version provided as an argument, or a default value if no argument is provided..Bx 4.3 Tahoe
.Bx 4.4
.Bx
Cd
Kernel configuration declaration. This denotes strings accepted by config(8). It is most often used in section 4 manual pages..Cd device le0 at scode?
Cm
Command modifiers. Typically used for fixed strings passed as arguments, unless Fl is more appropriate. Also useful when specifying configuration options or keys..Nm mt Fl f Ar device Cm rewind
.Nm ps Fl o Cm pid , Ns Cm command
.Nm dd Cm if= Ns Ar file1 Cm of= Ns Ar file2
.Cm IdentityFile Pa ~/.ssh/id_rsa
.Cm LogLevel Dv DEBUG
D1
One-line indented display. This is formatted by the default rules and is useful for simple indented statements. It is followed by a newline..D1 Fl abcdefgh
Db
This macro is obsolete. No replacement is needed. It is ignored by mandoc(1) and groff including its arguments. It was formerly used to toggle a debugging mode.Dd
Document date for display in the page footer. This is the mandatory first macro of any mdoc manual. Its syntax is as follows:.Dd month day, year
- To have the date automatically filled in by the OpenBSD version of cvs(1), the special string “$Mdocdate$” can be given as an argument.
- The traditional, purely numeric man(7) format year–month–day is accepted, too.
- If a date string cannot be parsed, it is used verbatim.
- If no date string is given, the current date is used.
.Dd $Mdocdate$
.Dd $Mdocdate: July 21 2007$
.Dd July 21, 2007
Dl
One-line indented display. This is formatted as literal text and is useful for commands and invocations. It is followed by a newline..Dl % mandoc mdoc.7 \(ba less
Do
Begin a block enclosed by double quotes. Does not have any head arguments..Do April is the cruellest month .Dc \(em T.S. Eliot
Dq
Encloses its arguments in “typographic” double-quotes..Dq April is the cruellest month \(em T.S. Eliot
Dt
Document title for display in the page header. This is the mandatory second macro of any mdoc file. Its syntax is as follows:
.Dt TITLE section [arch]
- TITLE
- The document's title (name), defaulting to “UNTITLED” if unspecified. To achieve a uniform appearance of page header lines, it should by convention be all caps.
- section
- The manual section. This may be one of 1 (General Commands), 2 (System Calls), 3 (Library Functions), 3p (Perl Library), 4 (Device Drivers), 5 (File Formats), 6 (Games), 7 (Miscellaneous Information), 8 (System Manager's Manual), or 9 (Kernel Developer's Manual). It should correspond to the manual's filename suffix and defaults to the empty string if unspecified.
- arch
- This specifies the machine architecture a manual page applies to, where relevant, for example alpha, amd64, i386, or sparc64. The list of valid architectures varies by operating system.
.Dt FOO 1
.Dt FOO 9 i386
Dv
Defined variables such as preprocessor constants, constant symbols, enumeration values, and so on..Dv NULL
.Dv BUFSIZ
.Dv STDOUT_FILENO
Dx
Format the DragonFly version provided as an argument, or a default value if no argument is provided..Dx 2.4.1
.Dx
Ec
Close a scope started by Eo. Its syntax is as follows:.Ec [TERM]
Em
Request an italic font. If the output device does not provide that, underline.Selected lines are those .Em not matching any of the specified patterns. Some of the functions use a .Em hold space to save the pattern space for subsequent retrieval.
En
This macro is obsolete. Use Eo or any of the other enclosure macros.Eo
An arbitrary enclosure. Its syntax is as follows:.Eo [TERM]
Er
Error constants for definitions of the errno libc global variable. This is most often used in section 2 and 3 manual pages..Er EPERM
.Er ENOENT
Es
This macro is obsolete. Use Eo or any of the other enclosure macros.Ev
Environmental variables such as those specified in environ(7)..Ev DISPLAY
.Ev PATH
Ex
Insert a standard sentence regarding command exit values of 0 on success and >0 on failure. This is most often used in section 1, 6, and 8 manual pages. Its syntax is as follows:.Ex -std [utility ...]
Fa
Function argument or parameter. Its syntax is as follows:.Fa "const char *p"
.Fa "int a" "int b" "int c"
.Fa "char *" size_t
Fd
Preprocessor directive, in particular for listing it in the SYNOPSIS. Historically, it was also used to document include files. The latter usage has been deprecated in favour of In..Fd #define sa_handler __sigaction_u.__sa_handler
.Fd #define SIO_MAXNFDS
.Fd #ifdef FS_DEBUG
.Ft void
.Fn dbg_open "const char *"
.Fd #endif
Fl
Command-line flag or option. Used when listing arguments to command-line utilities. Prints a fixed-width hyphen ‘-’ directly followed by each argument. If no arguments are provided, a hyphen is printed followed by a space. If the argument is a macro, a hyphen is prefixed to the subsequent macro output..Fl R Op Fl H | L | P
.Op Fl 1AaCcdFfgHhikLlmnopqRrSsTtux
.Fl type Cm d Fl name Pa CVS
.Fl Ar signal_number
.Fl o Fl
Fn
A function name. Its syntax is as follows:.Fn "int funcname" "int arg0" "int arg1"
.Fn funcname "int arg0"
.Fn funcname arg0
.Ft functype .Fn funcname
Fo
Begin a function block. This is a multi-line version of Fn. Its syntax is as follows:.Fo funcname
Fr
This macro is obsolete. No replacement markup is needed.Ft
A function type. Its syntax is as follows:.Ft functype
.Ft int
.Ft functype .Fn funcname
Fx
Format the FreeBSD version provided as an argument, or a default value if no argument is provided..Fx 7.1
.Fx
Hf
This macro is not implemented in mandoc(1)..Hf filename
Ic
Designate an internal or interactive command. This is similar to Cm but used for instructions rather than values..Ic :wq
.Ic hash
.Ic alias
In
The name of an include file. This macro is most often used in section 2, 3, and 9 manual pages..In sys/types.h
It
A list item. The syntax of this macro depends on the list type..It args
.It
.It [args]
.It cell [<TAB> cell ...]
.It "col1; <TAB> col2 ;" ;
Lb
Specify a library. The syntax is as follows:.Lb library
.Lb libz
.Lb libmandoc
Li
Denotes text that should be in aliteral
font mode. Note that this is a presentation term and should not be used for stylistically decorating technical terms.Lk
Format a hyperlink. Its syntax is as follows:.Lk uri [name]
.Lk http://bsd.lv "The BSD.lv Project"
.Lk http://bsd.lv
Ms
Display a mathematical symbol. Its syntax is as follows:.Ms symbol
.Ms sigma
.Ms aleph
Mt
Format a “mailto:” hyperlink. Its syntax is as follows:.Mt address
.Mt discuss@manpages.bsd.lv
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
Nd
A one line description of the manual's content. This is the mandatory last macro of the NAME section and not appropriate for other sections.Nm
The name of the manual page, or — in particular in section 1, 6, and 8 pages — of an additional command or feature documented in the manual page. When first invoked, the Nm macro expects a single argument, the name of the manual page. Usually, the first invocation happens in the NAME section of the page. The specified name will be remembered and used whenever the macro is called again without arguments later in the page. The Nm macro uses Block full-implicit semantics when invoked as the first macro on an input line in the SYNOPSIS section; otherwise, it uses ordinary In-line semantics..Sh SYNOPSIS .Nm cat .Op Fl benstuv .Op Ar
No
Normal text. Closes the scope of any preceding in-line macro. When used after physical formatting macros like Em or Sy, switches back to the standard font face and weight. Can also be used to embed plain text strings in macro lines using semantic annotation macros..Em italic , Sy bold , No and roman
.Sm off .Cm :C No / Ar pattern No / Ar replacement No / .Sm on
Ns
Suppress a space between the output of the preceding macro and the following text or macro. Following invocation, input is interpreted as normal text just like after an No macro..Ar name Ns = Ns Ar value
.Cm :M Ns Ar pattern
.Fl o Ns Ar output
Nx
Format the NetBSD version provided as an argument, or a default value if no argument is provided..Nx 5.01
.Nx
Op
Optional part of a command line. Prints the argument(s) in brackets. This is most often used in the SYNOPSIS section of section 1 and 8 manual pages..Op Fl a Ar b
.Op Ar a | b
Os
Operating system version for display in the page footer. This is the mandatory third macro of any mdoc file. Its syntax is as follows:.Os [system [version]]
.Os
.Os KTH/CSC/TCS
.Os BSD 4.3
Ot
This macro is obsolete. Use Ft instead; with mandoc(1), both have the same effect.Ox
Format the OpenBSD version provided as an argument, or a default value if no argument is provided..Ox 4.5
.Ox
Pa
An absolute or relative file system path, or a file or directory name. If an argument is not provided, the character ‘~’ is used as a default..Pa /usr/bin/mandoc
.Pa /usr/share/man/man7/mdoc.7
Pf
Removes the space between its argument (“prefix”) and the following macro. Its syntax is as follows:.Pf prefix macro arguments ...
.No prefixNs
macro arguments ...
.Pf $ Ar variable_name
.Pf 0x Ar hex_digits
Pp
Break a paragraph. This will assert vertical space between prior and subsequent macros and/or text.Ql
In-line literal display. This can for example be used for complete command invocations and for multi-word code fragments when more specific markup is not appropriate and an indented display is not desired. While mandoc(1) always encloses the arguments in single quotes, other formatters usually omit the quotes on non-terminal output devices when the arguments have three or more characters.Rs
Begin a bibliographic (“reference”) block. Does not have any head arguments. The block macro may only contain %A, %B, %C, %D, %I, %J, %N, %O, %P, %Q, %R, %T, %U, and %V child macros (at least one must be specified)..Rs .%A J. E. Hopcroft .%A J. D. Ullman .%B Introduction to Automata Theory, Languages, and Computation .%I Addison-Wesley .%C Reading, Massachusettes .%D 1979 .Re
Rv
Insert a standard sentence regarding a function call's return value of 0 on success and -1 on error, with the errno libc global variable set on error. Its syntax is as follows:.Rv -std [function ...]
Sh
Begin a new section. For a list of conventional manual sections, see MANUAL STRUCTURE. These sections should be used unless it's absolutely necessary that custom sections be used.Sm
Switches the spacing mode for output generated from macros. Its syntax is as follows:.Sm [on | off]
Ss
Begin a new subsection. Unlike with Sh, there is no convention for the naming of subsections. Except DESCRIPTION, the conventional sections described in MANUAL STRUCTURE rarely have subsections.St
Replace an abbreviation for a standard with the full form. The following standards are recognised. Where multiple lines are given without a blank line in between, they all refer to the same standard, and using the first form is recommended.- C language standards
-
- -ansiC
- ANSI X3.159-1989 (“ANSI C89”)
- -ansiC-89
- ANSI X3.159-1989 (“ANSI C89”)
- -isoC
- ISO/IEC 9899:1990 (“ISO C90”)
- -isoC-90
-
ISO/IEC 9899:1990 (“ISO C90”)
- -isoC-amd1
-
ISO/IEC 9899/AMD1:1995 (“ISO C90, Amendment 1”)
- -isoC-tcor1
-
ISO/IEC 9899/TCOR1:1994 (“ISO C90, Technical Corrigendum 1”)
- -isoC-tcor2
-
ISO/IEC 9899/TCOR2:1995 (“ISO C90, Technical Corrigendum 2”)
- -isoC-99
-
ISO/IEC 9899:1999 (“ISO C99”)
- -isoC-2011
-
ISO/IEC 9899:2011 (“ISO C11”)
- POSIX.1 before the Single UNIX Specification
-
- -p1003.1-88
- IEEE Std 1003.1-1988 (“POSIX.1”)
- -p1003.1
-
IEEE Std 1003.1 (“POSIX.1”)
- -p1003.1-90
- IEEE Std 1003.1-1990 (“POSIX.1”)
- -iso9945-1-90
-
ISO/IEC 9945-1:1990 (“POSIX.1”)
- -p1003.1b-93
- IEEE Std 1003.1b-1993 (“POSIX.1b”)
- -p1003.1b
-
IEEE Std 1003.1b (“POSIX.1b”)
- -p1003.1c-95
-
IEEE Std 1003.1c-1995 (“POSIX.1c”)
- -p1003.1i-95
-
IEEE Std 1003.1i-1995 (“POSIX.1i”)
- -p1003.1-96
- ISO/IEC 9945-1:1996 (“POSIX.1”)
- -iso9945-1-96
-
ISO/IEC 9945-1:1996 (“POSIX.1”)
- X/Open Portability Guide version 4 and related standards
-
- -xpg3
-
X/Open Portability Guide Issue 3 (“XPG3”)
- -p1003.2
- IEEE Std 1003.2 (“POSIX.2”)
- -p1003.2-92
- IEEE Std 1003.2-1992 (“POSIX.2”)
- -iso9945-2-93
-
ISO/IEC 9945-2:1993 (“POSIX.2”)
- -p1003.2a-92
-
IEEE Std 1003.2a-1992 (“POSIX.2”)
- -xpg4
-
X/Open Portability Guide Issue 4 (“XPG4”)
- Single UNIX Specification version 1 and related standards
-
- -susv1
- Version 1 of the Single UNIX Specification (“SUSv1”)
- -xpg4.2
-
X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”)
- -xsh4.2
-
X/Open System Interfaces and Headers Issue 4, Version 2 (“XSH4.2”)
- -xcurses4.2
-
X/Open Curses Issue 4, Version 2 (“XCURSES4.2”)
- -p1003.1g-2000
-
IEEE Std 1003.1g-2000 (“POSIX.1g”)
- -svid4
-
System V Interface Definition, Fourth Edition (“SVID4”),
- Single UNIX Specification version 2 and related standards
-
- -susv2
-
Version 2 of the Single UNIX Specification (“SUSv2”) This Standard was published in 1997 and is also called X/Open Portability Guide version 5. It was used as the basis for UNIX 98 certification. The following refer to parts of it.
- -xbd5
-
X/Open Base Definitions Issue 5 (“XBD5”)
- -xsh5
-
X/Open System Interfaces and Headers Issue 5 (“XSH5”)
- -xcu5
-
X/Open Commands and Utilities Issue 5 (“XCU5”)
- -xns5
- X/Open Networking Services Issue 5 (“XNS5”)
- -xns5.2
- X/Open Networking Services Issue 5.2 (“XNS5.2”)
- Single UNIX Specification version 3
-
- -p1003.1-2001
- IEEE Std 1003.1-2001 (“POSIX.1”)
- -susv3
-
Version 3 of the Single UNIX Specification (“SUSv3”)
- -p1003.1-2004
-
IEEE Std 1003.1-2004 (“POSIX.1”)
- Single UNIX Specification version 4
-
- -p1003.1-2008
- IEEE Std 1003.1-2008 (“POSIX.1”)
- -susv4
-
Version 4 of the Single UNIX Specification (“SUSv4”)
- -p1003.1-2013
-
IEEE Std 1003.1-2008/Cor 1-2013 (“POSIX.1”)
- Other standards
-
- -ieee754
-
IEEE Std 754-1985
- -iso8601
-
ISO 8601
- -iso8802-3
-
ISO 8802-3: 1989
- -ieee1275-94
- IEEE Std 1275-1994 (“Open Firmware”)
Sx
Reference a section or subsection in the same manual page. The referenced section or subsection name must be identical to the enclosed argument, including whitespace..Sx MANUAL STRUCTURE
Sy
Request a boldface font..Sy Warning : If .Sy s appears in the owner permissions, set-user-ID mode is set. This utility replaces the former .Sy dumpdir program.
Tn
Supported only for compatibility, do not use this in new manuals. Even though the macro name (“tradename”) suggests a semantic function, historic usage is inconsistent, mostly using it as a presentation-level macro to request a small caps font.Ud
Supported only for compatibility, do not use this in new manuals. Prints out “currently under development.”Ux
Supported only for compatibility, do not use this in new manuals. Prints out “UNIX”.Va
A variable name..Va foo
.Va const char *bar;
Vt
A variable type..Vt unsigned char
.Vt extern const char * const sys_signame[] ;
Xo
Extend the header of an It macro or the body of a partial-implicit block macro beyond the end of the input line. This macro originally existed to work around the 9-argument limit of historic roff(7).Xr
Link to another manual (“cross-reference”). Its syntax is as follows:.Xr name [section]
.Xr mandoc 1
.Xr mandoc 1 ;
.Xr mandoc 1 Ns s behaviour
MACRO SYNTAX
The syntax of a macro depends on its classification. In this section, ‘-arg’ refers to macro arguments, which may be followed by zero or more ‘parm’ parameters; ‘Yo’ opens the scope of a macro; and if specified, ‘Yc’ closes it out.Block full-explicit
Multi-line scope closed by an explicit closing macro. All macros contains bodies; only Bf and (optionally) Bl contain a head..Yo [-arg [parm...]] [head...] [body...] .Yc
Macro | Callable | Parsed | Scope |
Bd | No | No | closed by Ed |
Bf | No | No | closed by Ef |
Bk | No | No | closed by Ek |
Bl | No | No | closed by El |
Ed | No | No | opened by Bd |
Ef | No | No | opened by Bf |
Ek | No | No | opened by Bk |
El | No | No | opened by Bl |
Block full-implicit
Multi-line scope closed by end-of-file or implicitly by another macro. All macros have bodies; some (It -bullet, -hyphen, -dash, -enum, -item) don't have heads; only one (It in Bl -column) has multiple heads..Yo [-arg [parm...]] [head... [Ta head...]] [body...]
Macro | Callable | Parsed | Scope |
It | No | Yes | closed by It, El |
Nd | No | No | closed by Sh |
Nm | No | Yes | closed by Nm, Sh, Ss |
Sh | No | Yes | closed by Sh |
Ss | No | Yes | closed by Sh, Ss |
Block partial-explicit
Like block full-explicit, but also with single-line scope. Each has at least a body and, in limited circumstances, a head (Fo, Eo) and/or tail (Ec)..Yo [-arg [parm...]] [head...] [body...] .Yc [tail...] .Yo [-arg [parm...]] [head...] [body...] Yc [tail...]
Macro | Callable | Parsed | Scope |
Ac | Yes | Yes | opened by Ao |
Ao | Yes | Yes | closed by Ac |
Bc | Yes | Yes | closed by Bo |
Bo | Yes | Yes | opened by Bc |
Brc | Yes | Yes | opened by Bro |
Bro | Yes | Yes | closed by Brc |
Dc | Yes | Yes | opened by Do |
Do | Yes | Yes | closed by Dc |
Ec | Yes | Yes | opened by Eo |
Eo | Yes | Yes | closed by Ec |
Fc | Yes | Yes | opened by Fo |
Fo | No | No | closed by Fc |
Oc | Yes | Yes | closed by Oo |
Oo | Yes | Yes | opened by Oc |
Pc | Yes | Yes | closed by Po |
Po | Yes | Yes | opened by Pc |
Qc | Yes | Yes | opened by Oo |
Qo | Yes | Yes | closed by Oc |
Re | No | No | opened by Rs |
Rs | No | No | closed by Re |
Sc | Yes | Yes | opened by So |
So | Yes | Yes | closed by Sc |
Xc | Yes | Yes | opened by Xo |
Xo | Yes | Yes | closed by Xc |
Block partial-implicit
Like block full-implicit, but with single-line scope closed by the end of the line..Yo [-arg [val...]] [body...] [res...]
Macro | Callable | Parsed |
Aq | Yes | Yes |
Bq | Yes | Yes |
Brq | Yes | Yes |
D1 | No | Yes |
Dl | No | Yes |
Dq | Yes | Yes |
En | Yes | Yes |
Op | Yes | Yes |
Pq | Yes | Yes |
Ql | Yes | Yes |
Yes | Yes | |
Sq | Yes | Yes |
Vt | Yes | Yes |
Special block macro
The Ta macro can only be used below It in Bl -column lists. It delimits blocks representing table cells; these blocks have bodies, but no heads.Macro | Callable | Parsed | Scope |
Ta | Yes | Yes | closed by Ta, It |
In-line
Closed by the end of the line, fixed argument lengths, and/or subsequent macros. In-line macros have only text children. If a number (or inequality) of arguments is (n), then the macro accepts an arbitrary number of arguments..Yo [-arg [val...]] [args...] [res...] .Yo [-arg [val...]] [args...] Yc... .Yo [-arg [val...]] arg0 arg1 argN
Macro | Callable | Parsed | Arguments |
%A | No | No | >0 |
%B | No | No | >0 |
%C | No | No | >0 |
%D | No | No | >0 |
%I | No | No | >0 |
%J | No | No | >0 |
%N | No | No | >0 |
%O | No | No | >0 |
%P | No | No | >0 |
%Q | No | No | >0 |
%R | No | No | >0 |
%T | No | No | >0 |
%U | No | No | >0 |
%V | No | No | >0 |
Ad | Yes | Yes | >0 |
An | Yes | Yes | >0 |
Ap | Yes | Yes | 0 |
Ar | Yes | Yes | n |
At | Yes | Yes | 1 |
Bsx | Yes | Yes | n |
Bt | No | No | 0 |
Bx | Yes | Yes | n |
Cd | Yes | Yes | >0 |
Cm | Yes | Yes | >0 |
Db | No | No | 1 |
Dd | No | No | n |
Dt | No | No | n |
Dv | Yes | Yes | >0 |
Dx | Yes | Yes | n |
Em | Yes | Yes | >0 |
Er | Yes | Yes | >0 |
Es | Yes | Yes | 2 |
Ev | Yes | Yes | >0 |
Ex | No | No | n |
Fa | Yes | Yes | >0 |
Fd | No | No | >0 |
Fl | Yes | Yes | n |
Fn | Yes | Yes | >0 |
Fr | Yes | Yes | >0 |
Ft | Yes | Yes | >0 |
Fx | Yes | Yes | n |
Hf | No | No | n |
Ic | Yes | Yes | >0 |
In | No | No | 1 |
Lb | No | No | 1 |
Li | Yes | Yes | >0 |
Lk | Yes | Yes | >0 |
Lp | No | No | 0 |
Ms | Yes | Yes | >0 |
Mt | Yes | Yes | >0 |
Nm | Yes | Yes | n |
No | Yes | Yes | 0 |
Ns | Yes | Yes | 0 |
Nx | Yes | Yes | n |
Os | No | No | n |
Ot | Yes | Yes | >0 |
Ox | Yes | Yes | n |
Pa | Yes | Yes | n |
Pf | Yes | Yes | 1 |
Pp | No | No | 0 |
Rv | No | No | n |
Sm | No | No | <2 |
St | No | Yes | 1 |
Sx | Yes | Yes | >0 |
Sy | Yes | Yes | >0 |
Tn | Yes | Yes | >0 |
Ud | No | No | 0 |
Ux | Yes | Yes | n |
Va | Yes | Yes | n |
Vt | Yes | Yes | >0 |
Xr | Yes | Yes | >0 |
br | No | No | 0 |
sp | No | No | 1 |
Delimiters
When a macro argument consists of one single input character considered as a delimiter, the argument gets special handling. This does not apply when delimiters appear in arguments containing more than one character. Consequently, to prevent special handling and just handle it like any other argument, a delimiter can be escaped by prepending a zero-width space (‘\&’). In text lines, delimiters never need escaping, but may be used as normal punctuation..Aq ( [ word ] ) .
([⟨word⟩]).
- (
- left parenthesis
- [
- left bracket
- .
- period
- ,
- comma
- :
- colon
- ;
- semicolon
- )
- right parenthesis
- ]
- right bracket
- ?
- question mark
- !
- exclamation mark
.Fl a ( b | c \*(Ba d ) e
-a (-b | -c | -d) -e
- |
- vertical bar
Font handling
In mdoc documents, usage of semantic markup is recommended in order to have proper fonts automatically selected; only when no fitting semantic markup is available, consider falling back to Physical markup macros. Whenever any mdoc macro switches the roff(7) font mode, it will automatically restore the previous font when exiting its scope. Manually switching the font using the roff(7) ‘\f
’ font escape sequences is never required.COMPATIBILITY
This section provides an incomplete list of compatibility issues between mandoc and GNU troff (“groff”).- Dd with non-standard arguments behaves very strangely. When there are three arguments, they are printed verbatim. Any other number of arguments is replaced by the current date, but without any arguments the string “Epoch” is printed.
- Lk only accepts a single link-name argument; the remainder is misformatted.
- Pa does not format its arguments when used in the FILES section under certain list types.
- Ta can only be called by other macros, but not at the beginning of a line.
- %C is not implemented (up to and including groff-1.22.2).
- ‘\f’ (font face) and ‘\F’ (font family face) Text Decoration escapes behave irregularly when specified within line-macro scopes.
- Negative scaling units return to prior lines. Instead, mandoc truncates them to zero.
- Bd -file file is unsupported for security reasons.
- Bd -filled does not adjust the right margin, but is an alias for Bd -ragged.
- Bd -literal does not use a literal font, but is an alias for Bd -unfilled.
- Bd -offset center and -offset right don't work. Groff does not implement centered and flush-right rendering either, but produces large indentations.