-
-
Notifications
You must be signed in to change notification settings - Fork 6
Generating Man Pages
Apex can convert Markdown to roff (man page source) or to styled HTML that looks like a man page. You do not need Pandoc or go-md2man; the built apex binary generates man pages directly from your Markdown source.
Use -t or --to to select the format:
| Format | Description |
|---|---|
| man | Groff/troff roff source (.TH, .SH, .TP, etc.). Use this to produce .1, .5, .7 files for man(1). |
| man-html | Styled HTML that resembles a man page (single document with man-like sections and typography). |
Examples:
# Generate roff (man page source) - write to a file
apex -t man man/apex.1.md > man/apex.1
# View with man (after installing or from build dir)
man ./man/apex.1
# or: groff -man -Tutf8 man/apex.1 | less
# Generate styled HTML man page
apex -t man-html man/apex.1.md > apex-man.htmlExample source and rendered output: apex.1.md (Markdown source), apex.1.html (man-html with -s, view in browser).
Output is written to stdout; redirect to a file or pipe to man/groff as needed.
Man page source is typically written in Markdown with:
-
Pandoc-style metadata at the top (optional but useful for
.TH):% TITLE(SECTION) % Author % Date
-
Top-level headings for sections:
# NAME,# SYNOPSIS,# DESCRIPTION,# OPTIONS, etc. Apex turns#into.SHand##into.SS. -
Definition lists for options: put the option name on one line and the description on the next line starting with
:or:::**-o** *FILE*, **--output** *FILE* : Write output to *FILE* instead of stdout. **--standalone** : Generate complete HTML document with doctype and body tags.
-
Inline formatting: use
**bold**and*italic*for option names and arguments; they are converted to roff\f[B]and\f[I].
Code in backticks is emitted as roman in roff (for compatibility with all groff devices). Definition list blocks are converted to roff .TP (tagged paragraph) style so each option appears with its description.
If you are building Apex from source:
Using the Makefile:
make build # ensure apex is built
make man # generate man/apex.1, man/apex-config.5, man/apex-plugins.7 from their .md sourcesmake man depends on build, so it will build the apex binary first if needed, then run apex -t man on each .md file and write the result to the corresponding man file (e.g. man/apex.1.md -> man/apex.1).
Using CMake directly:
When you run cmake --build build (or make in the build directory), the man_pages target is built by default. CMake runs apex -t man on each man Markdown source and writes the roff into the build directory. Those files are used at install time (cmake --install build) and installed under share/man/man1, etc.
You can also generate a single page by hand:
./build/apex -t man man/apex.1.md > man/apex.1-
man(1): If the man file is installed (e.g. under
/usr/local/share/man), run:man apex
-
From file: To view a roff file without installing:
man ./man/apex.1 # or groff -man -Tutf8 man/apex.1 | less
-
Command Line Options - All
-t/--toformats and other flags. - Rendering Markdown in the Terminal - Terminal output formats.
Copyright 2025 Brett Terpstra, All Rights Reserved | MIT License
- Getting Started - Your first steps with Apex
- Installation - How to build and install Apex
- Usage - Basic usage examples
- Syntax - Complete syntax reference for unified mode
- Callouts - All supported callout formats and flag requirements
- Tables - Complete table syntax reference including rowspan, colspan, alignment, and captions
- Inline Attribute Lists - IALs and ALDs guide with examples
- Modes - Understanding processor modes
-
Quarto Mode - Pandoc/Quarto markdown (
--mode quarto) - Command Line Options - All CLI flags explained
-
Rendering Markdown in the Terminal - Terminal output formats (
-t terminal,-t terminal256),--width,--theme, and theming -
Generating Man Pages - Generate man pages from Markdown using
apex -t man -
Multi-file Documents - Combining multiple files with
--combine,--mmd-merge, and includes - Citations - Citations and bibliography guide
- Indices - Index generation with mmark and TextIndex syntax
-
Metadata Transforms - Transform metadata values with
[%key:transform] - Integrating with Pandoc - Use Apex with Pandoc for DOCX, PDF, and more
- Using Apex with Jekyll - Use the apex-ruby gem as Jekyll’s Markdown converter (untested; feedback welcome)
- Header IDs - How header IDs are generated
- C API - Programmatic API documentation
- Writing Tests - How to add tests for new features
- Xcode Integration - Using Apex in Xcode projects
- Examples - Practical usage examples
- Plugins - Plugin system, examples, and recipes
- Filters - AST filters (Pandoc-style JSON), examples, and usage
- Troubleshooting - Common issues and solutions
- Credits - Acknowledgments and links to related projects