HOME

TheInfoList



OR:

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 troff (), short for "typesetter roff", is the major component of a document processing system developed by Bell Labs for the Unix operating system. troff and the related nroff were both developed from the original roff (software), roff. Whil ...
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 Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
distributions, as well as a subset of roff commands occasionally intermixed with the ''man'' macros. 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. 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.


History

Development began in November 2008 specifically to produce CSS-enabled
HTML Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
forms of manuals in response to the limitations of groff. mandoc gained initial text-mode output in February 2009. It was then showcased at AsiaBSDCon-2009. In summer of 2010, mandoc was the subject of a NetBSD-mentored Google Summer of Code project for producing
PostScript PostScript (PS) is a page description language and dynamically typed, stack-based programming language. It is most commonly used in the electronic publishing and desktop publishing realm, but as a Turing complete programming language, it c ...
and PDF output alongside the existing text, HTML, and
XHTML Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages which mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated. While HTML, pr ...
outputs. This work was completed in August 2010. mandoc became the default formatter of manuals for OpenBSD 4.8, released in November 2010. It later became the default formatter in NetBSD, FreeBSD,
illumos Illumos (stylized as "illumos") is a partly free and open-source Unix operating system. It has been developed since 2010 and is based on OpenSolaris, after the discontinuation of that product by Oracle. It comprises a kernel, device driver ...
, Void Linux, Alpine Linux and
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, and is also included in DragonFlyBSD, MINIX 3,
Debian Debian () is a free and open-source software, free and open source Linux distribution, developed by the Debian Project, which was established by Ian Murdock in August 1993. Debian is one of the oldest operating systems based on the Linux kerne ...
, Ubuntu, Gentoo, and Fedora. Its advantages were stated as high speed, license, and clean reimplementation.


Sample usage

The following demonstrates running mandoc on its own. Usually, it would be called via the
man A man is an adult male human. Before adulthood, a male child or adolescent is referred to as a boy. Like most other male mammals, a man's genome usually inherits an X chromosome from the mother and a Y chromosome from the f ...
utility. In this example, foo.1 is the name of an ''mdoc'' UNIX manual. $ # Page manual to the terminal. $ mandoc -l foo.1 $ # HTML output with a style-sheet. $ mandoc -Thtml -Ostyle=style.css >foo.1.html Multibyte (localised) manuals may also be rendered without preprocessing. In this example, foo.jp.1 is a Japanese manual encoded in
UTF-8 UTF-8 is a character encoding standard used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode Transformation Format 8-bit''. Almost every webpage is transmitted as UTF-8. UTF-8 supports all 1,112,0 ...
. mandoc will automatically detect the encoding. $ # Page wide-character manual to the terminal. $ mandoc -l foo.jp.1 The included apropos implementation can use semantic information in search: $ # Search for all functions starting with 'str' having return type size_t: $ apropos -s 3 Ft=size_t -a Nm~^str


Other features

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


References


External links


The mandoc UNIX manpage compiler toolset

OpenBSD online manpages
generated by mandoc's man.cgi program
Undeadly article on mandoc

Google Summer of Code mandoc_ps project site
- work on PostScript support
Freecode page for mandoc
- used until 1.12.2 {{OpenBSD BSD software OpenBSD software using the ISC license