mdocml – mdoc macro compiler


mdocml is a suite of tools compiling -mdoc, the roff macro package of choice for BSD manual pages, and -man, the predominant historical package for UNIX manuals. The mission of mdocml is to deprecate groff, the GNU roff implementation, for displaying -mdoc pages whilst providing token support for -man.

Why? groff amounts to over 5 MB of source code, most of which is C++ and all of which is GPL. It runs slowly, produces uncertain output, and varies in operation from system to system. mdocml strives to fix this (respectively small, C, ISC-licensed, fast and regular).

The core of mdocml is composed of the libmdoc and libman validating compiler libraries. Both are simple, fast libraries operating on memory buffers, so they may be used for a variety of front-ends (terminal-based, CGI and so on). The primary front-end is mandoc, which formats manuals for display on the terminal.

The mdocml utility is a Project member.


Sources correctly build and install on DragonFly BSD, FreeBSD, OpenBSD, NetBSD, and GNU/Linux operating systems, tested variously on i386, AMD64, alpha, and others. The most current version is @VERSION@, dated @VDATE@. A full ChangeLog (txt) is written with each release.


Source archive /snapshots/mdocml.tar.gz (md5)
Online source cvsweb


DragonFly BSD usr.bin/mandoc
FreeBSD ports/textproc/mdocml
NetBSD src/external/bsd/mdocml
OpenBSD src/usr.bin/mandoc


Source archive /snapshots/


These manuals are generated automatically and refer to the current snapshot.

mandoc(1) (text) format and display UNIX manuals
mandoc_char(7) (text) mandoc special characters
mdoc(7) (text) mdoc language reference
man(7) (text) man language reference
manuals(7) (text) a guide to writing UNIX manuals
mdoc(3) (text) mdoc macro compiler library
man(3) (text) man macro compiler library


For all issues related to mdocml, contact Kristaps Dzonsons,

If you want to receive a semi-automated mail-out of new releases, then please write with a message subject of subscribe mdocml (or unsubscribe mdocml).


30-03-2010 Version 1.9.20: more efforts to get roff instructions in -man documents under control. Note that roff instructions embedded in line-scoped, next-line macros (e.g. B) are not supported. Leading punctuation for -mdoc macros, such as Fl ( ( a, are now correctly handled.
27-03-2010 Version 1.9.18: many fixes (largely pertaining to scope) and improvements (e.g., handling of apostrophe-control macros, which fixes the strange BR seen in some macro output) to handling roff instructions in -man documents.
25-03-2010 Version 1.9.17 highlights: accept perlpod standard preamble. Also accept (and discard) de, dei, am, ami, and ig roff macro blocks.
22-03-2010 Version 1.9.16 highlights: inspired by patches and bug reports by Ingo Schwarze, allowed -man to accept non-printing elements to be nested within next-line scopes, such as br within B or TH, which is valid roff. Longsoon architecture also noted and Makefile cleaned up.
18-02-2010 Moved to our new home. Version 1.9.15 highlights: XHTML is now an acceptable output mode for mandoc(1); Xr made more compatible with groff; Vt fixed when invoked in SYNOPSIS; \\ escape removed; end-of-line white-space detected for all lines; subtle bug fixed in list display for some modes; compatibility layer checked in for compilation in diverse UNIX systems; and column lengths handled correctly.
Copyright © 2008–2010 Kristaps Dzonsons, $Date: 2010/03/30 08:24:01 $