| PREVIEW(1) | General Commands Manual | PREVIEW(1) |
NAME
preview —
preview Markdown files in the browser, rendered like
GitHub
SYNOPSIS
preview |
[-b-d
feature[,... ]-H
host-p
port--log-level
level--mermaid-icon-pack
pack[,... ]--no-border--no-reloadfile |
folder ] |
preview |
-h |
-v |
DESCRIPTION
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:
-b,--browser- Open the start page in the default browser.
-d,--disablefeature[,...]- Turn off Markdown features. A feature is
one of
details,footnote,ghissue,mathjaxormermaid. The option can be repeated. -H,--hosthost- Listen on host, a host name or IP
address. The default is
localhost, which other machines cannot reach. Use0.0.0.0to listen on all interfaces. -h,--help- Print a usage summary and exit.
--log-levellevel- How much to log on standard error:
error,warn,infoordebug. The default,info, logs the startup lines, warnings and errors.debugadds a line per request, file system event, reload and live reload connection. --mermaid-icon-packpack[,...]- Let Mermaid diagrams use icons from the named iconify icon packs, such as
logosfor ‘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. --no-border- Render the page without the border around its content.
--no-reload- Do not reload pages when files change.
-p,--portport- Listen on port. Without this option
previewuses port 6419, or the first free port of the twenty that follow when 6419 is busy. A port given with-pis used or fails. -v,--version- Print the version and exit.
KEYS
The keys below are shown in the browser by pressing?.
Folder page
Down,j- Next row.
Up,k- Previous row.
Home,End- First and last row.
Enter,Right,l- Open the file or folder.
Backspace,Esc,Left,h- Up to the parent folder.
File page
Left,h- Previous Markdown file in the folder.
Right,l- Next Markdown file in the folder.
Esc- Up to the folder.
Any page
?- Show or hide the list of keys.
EXIT STATUS
Thepreview utility exits 0 on
success, and >0 if an error occurs.
preview runs until interrupted, for example
with Control-C.
EXAMPLES
Render a README and open it in the browser:$ preview -b README.md$ preview -H 0.0.0.0 -p 8080
docs/$ preview -d mathjax,mermaid
notes.mdSEE ALSO
https://github.com/troglobit/previewHISTORY
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.