CLI Reference
Overview
| Command | Description |
|---|---|
convert |
Convert an MkDocs site to PDF and/or DOCX |
init |
Generate a starter leafpress.yml branding config |
info |
Display detected MkDocs site info |
ui |
Launch the desktop menu bar / system tray app |
convert
Convert an MkDocs site to PDF and/or DOCX.
Arguments
| Argument | Description |
|---|---|
SOURCE |
Path to a local MkDocs project directory, or a git URL |
Options
| Option | Default | Description |
|---|---|---|
--output, -o |
output/ |
Output directory for generated files |
--format, -f |
pdf |
Output format: pdf, docx, or both |
--config, -c |
(auto-detect) | Path to leafpress.yml branding config |
--mkdocs-config |
(auto-detect) | Override path to mkdocs.yml |
--branch, -b |
(default branch) | Git branch to clone (remote sources only) |
--cover-page / --no-cover-page |
--cover-page |
Include a cover page |
--toc / --no-toc |
--toc |
Include a table of contents |
--open |
false |
Open the generated file(s) after conversion |
--verbose |
false |
Show full traceback on error |
Examples
# Convert local project to PDF
leafpress convert /path/to/project
# Convert to both PDF and DOCX
leafpress convert /path/to/project -f both
# Convert with branding config, output to custom dir
leafpress convert /path/to/project -c leafpress.yml -o dist/
# Convert from a git URL (specific branch)
leafpress convert https://github.com/org/repo -b main -f pdf
# No cover page, open after conversion
leafpress convert . --no-cover-page --open
# Use a specific mkdocs.yml (monorepo)
leafpress convert /path/to/project --mkdocs-config /path/to/docs/mkdocs.yml
Config auto-detection
leafpress looks for leafpress.yml or leafpress.yaml in the project root automatically. You only need --config if the file is elsewhere.
leafpress also loads a .env file from the project root and applies any LEAFPRESS_* environment variables on top of the YAML config. See Configuration.
init
Generate a starter leafpress.yml branding config file.
Arguments
| Argument | Default | Description |
|---|---|---|
PATH |
. |
Directory to create the config file in |
Example
leafpress init
# Creates ./leafpress.yml
leafpress init /path/to/project
# Creates /path/to/project/leafpress.yml
info
Display detected MkDocs site info: navigation structure, markdown extensions, and git information.
Arguments
| Argument | Description |
|---|---|
SOURCE |
Path to a local MkDocs directory or git URL |
Options
| Option | Description |
|---|---|
--branch, -b |
Git branch (for remote git URLs) |
Example
ui
Launch the leafpress menu bar / system tray desktop application.
Options
| Option | Default | Description |
|---|---|---|
--show |
false |
Open the conversion window immediately on launch |
Example
Requires the [ui] extra. See Desktop UI for installation and usage details.