https://github.com/bmoneill/md2roff
A markdown to roff (ms or manpage) compiler
https://github.com/bmoneill/md2roff
compiler groff lex manpage-generator manpages markdown pandoc roff troff
Last synced: about 1 month ago
JSON representation
A markdown to roff (ms or manpage) compiler
- Host: GitHub
- URL: https://github.com/bmoneill/md2roff
- Owner: bmoneill
- License: mit
- Created: 2020-04-11T03:02:18.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-08-10T17:36:31.000Z (2 months ago)
- Last Synced: 2025-08-10T19:22:55.489Z (2 months ago)
- Topics: compiler, groff, lex, manpage-generator, manpages, markdown, pandoc, roff, troff
- Language: Lex
- Homepage:
- Size: 180 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# md2roff

`md2roff` converts Markdown to roff source (ms or man formats). This is useful
for converting Markdown files to printable PDFs or generating a manpage from
a Markdown file.## Prerequisites
* A [lex](https://github.com/westes/flex/).
## Building
### Linux
```shell
make
sudo make install
```## Usage
The wrapper program, `md2roff`, must take either `-ms` or `-man` as an argument.
Arguments for `md2ms` and `md2man` may be added as well. Input and output files
are `stdin` and `stdout` by default.```shell
md2roff [-ms|-man] [-t title] [-o outputfile] [args...] [inputfile]
```Note: `md2roff` must be installed for the wrapper to work.
## Options
### md2ms
```shell
md2ms [-bnT] [-t title] [-a author] [-o outputfile] [inputfile]
```* `-b`: Disable page break between the title page and contents.
* `-n`: Disable display of the current date.
* `-T`: Use the first heading (`#`) as the document title.
* `-t title`: Set the document title.
* `-a author`: Set the document author.
* `-o outputfile`: Set the output file.### md2man
```shell
md2man [-t title] [-o outputfile] [inputfile]
```* `-t title`: Add custom title header (`.TH`)
* `-o outputfile`: Set the output file.### Examples
* See [examples/README.pdf](examples/README.pdf) for a PDF version of this README generated by `md2roff`.
* See [examples/README.1](examples/README.1) for a manpage version of this README generated by `md2roff`.```shell
# Convert to postscript
md2roff -ms -t "My File" mymarkdown.md | groff -ms -Tps >myps.ps# Convert to PDF
md2roff -ms -t "My File" mymarkdown.md | groff -ms -Tpdf >mypdf.pdf# Convert to manpage
md2roff -man -t 'MYMANPAGE 1 "May 2025" "mymanpage" "User Commands"' mymarkdown.md >mymanpage.1
```## Bugs
If you find a bug, submit an issue, PR, or email me with a description and/or patch.
## License
Copyright (c) 2019-2025 Ben O'Neill . This work is released under the
terms of the MIT License. See [LICENSE](LICENSE) for the license terms.