troglobit/man
PREVIEW(1) General Commands Manual PREVIEW(1)

preview —
preview Markdown files in the browser, rendered like GitHub

preview [
-b
] [
-d feature[
,...
]
] [
-H host
] [
-p port
] [
--log-level level
] [
--mermaid-icon-pack pack[
,...
]
] [
--no-border
] [
--no-reload
] [
file | folder
]

preview -h | -v

preview is a small web server that renders Markdown files the way GitHub does. It uses GitHub's stylesheets and colour themes, and supports tables, task lists, alerts, footnotes, emoji, front matter, math and Mermaid diagrams. Everything it needs is built in, so it works without network access.
Given a file, preview serves the folder that holds it and opens the file. Given a folder, it serves that folder and opens its folder page. Without an argument it serves the current directory. A path that does not exist is an error.
A folder page lists the folder's entries, folders first, with size and modification time, and renders the folder's README below the list, as GitHub does. Files ending in .md, .markdown, .mdown, .mdwn, .mkd, .mkdn or .mkdown are rendered. Other files are served as they are, so images and links between documents work.
While a page is open, preview watches what it shows: the Markdown file and the local images it references, or for a folder page, the folder's entries. When one of them changes the page reloads. Editor temporary and swap files are ignored.
The buttons in the top right corner cycle the colour theme between light, dark and dark dimmed, set the content width, switch to GitHub's colorblind palette, and pause reloading for the open page. Without a stored choice the theme follows the operating system.
The options are as follows:
, --browser
Open the start page in the default browser.
, --disable feature[
,...
]
Turn off Markdown features. A feature is one of details, footnote, ghissue, mathjax or mermaid. The option can be repeated.
, --host host
Listen on host, a host name or IP address. The default is localhost, which other machines cannot reach. Use 0.0.0.0 to listen on all interfaces.
, --help
Print a usage summary and exit.
level
How much to log on standard error: error, warn, info or debug. The default, info, logs the startup lines, warnings and errors. debug adds a line per request, file system event, reload and live reload connection.
pack[
,...
]
Let Mermaid diagrams use icons from the named iconify icon packs, such as logos for ‘logos:docker-icon’. The browser fetches a pack from https://unpkg.com the first time a diagram uses one of its icons, so this option needs network access.
Render the page without the border around its content.
Do not reload pages when files change.
, --port port
Listen on port. Without this option preview uses port 6419, or the first free port of the twenty that follow when 6419 is busy. A port given with -p is used or fails.
, --version
Print the version and exit.

The keys below are shown in the browser by pressing ?.

, j
Next row.
, k
Previous row.
, End
First and last row.
, Right, l
Open the file or folder.
, Esc, Left, h
Up to the parent folder.

, h
Previous Markdown file in the folder.
, l
Next Markdown file in the folder.
Up to the folder.

Show or hide the list of keys.

The preview utility exits 0 on success, and >0 if an error occurs. preview runs until interrupted, for example with Control-C.

Render a README and open it in the browser:
$ preview -b README.md
Browse a documentation folder from another machine, on port 8080:
$ preview -H 0.0.0.0 -p 8080 docs/
Render without math and Mermaid support:
$ preview -d mathjax,mermaid notes.md

https://github.com/troglobit/preview

preview is a fork of go-grip by Christoph Herb, itself a Go reimplementation of the Python grip by Joe Esposito.
November 8, 2026 Debian

Maintained in troglobit/preview as doc/preview.1. Send corrections there, or read it on the mirror.