CLI Reference

CLI Reference

Complete reference for mbr’s command-line interface.

For configuration file settings, environment variables, and feature-specific behavior tuning, see the Configuration Reference.

Usage

mbr [OPTIONS] [PATH]

If PATH is omitted, mbr uses the current directory.

Mode Flags

These flags are mutually exclusive:

FlagDescription
(none)Launch GUI window (default with gui feature)
-s, --serverStart web server only (no GUI)
-g, --guiLaunch native GUI window (explicit)
-b, --buildGenerate static site
--extract-video-metadataExtract video metadata to sidecar files (requires media-metadata feature)
--extract-pdf-coverExtract cover images from PDF files (requires media-metadata feature)

Media File Arguments in GUI Mode

When a media file (video, audio, image, or PDF) is passed as the PATH argument in GUI mode, mbr automatically opens the appropriate media viewer instead of displaying the raw file. For example, mbr -g videos/demo.mp4 opens the video viewer at /.mbr/videos/?path=%2Fvideos%2Fdemo.mp4.

Supported media types are detected by file extension:

TypeExtensions
Videomp4, m4v, mov, webm, flv, mpg, mpeg, avi, 3gp, wmv, mkv, ts, mts, m2ts, vob, divx, xvid, asf, rm, rmvb, f4v, ogv
Audiomp3, wav, ogg, flac, aac, m4a, aiff, aif, oga, opus, wma
Imagejpg, jpeg, png, webp, gif, bmp, tif, tiff, svg
PDFpdf

Options

OptionDescriptionDefault
--output <PATH>Output directory for static buildbuild
--template-folder <PATH>Custom template folder(uses .mbr/)
--oembed-timeout-ms <MS>Timeout for URL metadata fetch (0 to disable)500 (server/GUI), 0 (build)
--oembed-cache-size <BYTES>Max oembed cache size (0 to disable)2097152 (2MB)
--build-concurrency <N>Files to process in parallel during buildauto (2x cores, max 32)
--skip-link-checksSkip internal link validation during buildfalse
--no-link-trackingDisable bidirectional link trackingfalse
--mark-incompleteHighlight blocks starting with TK/TODO/FIXME/XXXserver/GUI: on, build: off
--no-mark-incompleteDisable incomplete-block highlightingserver/GUI: off, build: on (no effect)
--title-prefix <TEXT>Text to prepend to all page titles"" (empty)
--title-suffix <TEXT>Text to append to all page titles"" (empty)
--transcode[EXPERIMENTAL] Enable dynamic video transcoding (server/GUI mode only)false
-v, --verboseIncrease log verbositywarn level
-q, --quietSuppress output except errors
--helpPrint help message
--versionPrint version

Boolean Flag Naming Convention

mbr uses two patterns for boolean flags that disable behavior:

Verbosity Levels

FlagLevel
(none)warn
-vinfo
-vvdebug
-vvvtrace

The RUST_LOG environment variable overrides these flags.

Examples

# Launch GUI (default mode)
mbr ~/notes
mbr README.md

# Render single file to stdout (CLI mode)
mbr -o README.md
mbr -o README.md > output.html

# Start server on default port
mbr -s ~/notes

# Start server with debug logging
mbr -s -vv ~/notes

# Launch GUI window (explicit)
mbr -g ~/notes

# Open a media file in the GUI media viewer
mbr -g videos/example.mp4    # Opens video viewer
mbr -g music/song.mp3        # Opens audio player
mbr -g images/photo.jpg      # Opens image viewer
mbr -g docs/paper.pdf        # Opens PDF viewer

# Build static site
mbr -b ~/notes

# Build to custom directory
mbr -b --output ./public ~/notes

# Use custom template folder
mbr -s --template-folder ./my-theme ~/notes

# Increase oembed timeout
mbr -s --oembed-timeout-ms 2000 ~/notes

# Disable oembed fetching (uses plain links)
mbr -s --oembed-timeout-ms 0 ~/notes

Media Viewer Endpoints

mbr provides dedicated viewer pages for media files. These endpoints render media content within the site’s navigation chrome (header, breadcrumbs, theme) for a consistent browsing experience.

Available Endpoints

EndpointDescription
/.mbr/videos/Video player page
/.mbr/pdfs/PDF viewer page
/.mbr/audio/Audio player page

Usage

Each endpoint accepts a path query parameter specifying the media file location (relative to repository root):

# Video viewer
http://localhost:5200/.mbr/videos/?path=/videos/demo.mp4

# PDF viewer
http://localhost:5200/.mbr/pdfs/?path=/docs/report.pdf

# Audio player
http://localhost:5200/.mbr/audio/?path=/music/track.mp3

The path parameter should be URL-encoded if it contains spaces or special characters:

# Path with spaces
http://localhost:5200/.mbr/videos/?path=/videos/My%20Video.mp4

Features

Video viewer:

PDF viewer:

Audio player:

Security

The media viewer validates all paths to prevent directory traversal attacks:

Invalid paths return an error page rather than exposing file system contents.

Static Builds

During static site generation (-b), media viewer pages are generated at:

build/
└── .mbr/
    ├── videos/
    │   └── index.html
    ├── pdfs/
    │   └── index.html
    └── audio/
        └── index.html

These pages work identically in static builds using client-side JavaScript to load and display media based on the path query parameter.

Examples

# Start server and open video viewer
mbr -s ~/notes
open "http://localhost:5200/.mbr/videos/?path=/videos/demo.mp4"

# Generate static site with media viewers
mbr -b ~/notes
# Viewer pages are at build/.mbr/videos/index.html, etc.

# Test directory traversal protection (should show error)
curl -s "http://localhost:5200/.mbr/videos/?path=/../../../etc/passwd"
# Returns error page, not file contents