mandoc | |
Released: | November 2008 |
Latest Release Version: | 1.14.6 |
Latest Release Date: | [1] |
Programming Language: | C |
Genre: | Typesetting |
License: | ISC license |
mandoc (historically called mdocml) is a utility used for formatting man pages in BSD Operating Systems (e.g. NetBSD), specifically those written in the mdoc and man macro languages. Unlike the groff and older troff and nroff tools that are predominantly used for this purpose by tools such as, mandoc focuses specifically on manuals and is not suitable for general-purpose type-setting.
is mainly used to format the mdoc manuals used in the BSD Operating Systems, but it also implements most of the man macros used in Linux distributions, as well as a subset of roff commands occasionally intermixed with the man macros.[1] It does not support other macro sets such as mm and ms, or any typesetting features like hyphenation, fonts and alignment. Simple styling such as bold and italics are supported, but italicized text is replaced by underlined text on the terminal.[2] [3]
mandoc has built-in support for the troff soelim (inclusion) preprocessor and partial built-in support for tbl and eqn. It has strong support for UTF-8 output. It can also use the semantic information in mdoc manuals to implement semantic search, which before version 1.4.1, relied on sqlite.[1]
Development began in November 2008 specifically to produce CSS-enabled HTML forms of manuals in response to the limitations of groff. mandoc gained initial text-mode output in February 2009.[4] It was then showcased at AsiaBSDCon-2009.[5] [6] [7] In summer of 2010, mandoc was the subject of a NetBSD-mentored Google Summer of Code project[8] for producing PostScript and PDF output alongside the existing text, HTML, and XHTML outputs. This work was completed in August 2010.[9] mandoc became the default formatter of manuals for OpenBSD 4.8, released in November 2010.[10] [11] It later became the default formatter in NetBSD, FreeBSD, illumos, Void Linux, Alpine Linux and macOS, and is also included in DragonFlyBSD, MINIX 3, Debian, Ubuntu, Gentoo, and Fedora.[12] Its advantages were stated as high speed,[13] license, and clean reimplementation.
The following demonstrates running mandoc
on its own. Usually, it would be called via the man utility. In this example, foo.1
is the name of an mdoc UNIX manual.foo.jp.1
is a Japanese manual encoded in UTF-8. mandoc will automatically detect the encoding.
mandoc
supports HTML 5, PostScript, and PDF output via the parameter.man.cgi
is a CGI program designed to display manual pages on the web. OpenBSD uses it to format all its manual pages.