MarkView is a zero-config Markdown preview server powered by Go and Bun.
It focuses on local documentation reading: fast startup, live updates, clear sidebar navigation, and solid support for Mermaid diagrams and code highlighting.
- 🚀 Zero Config: run it in any directory, open
README.mdby default, or show a directory listing when it is missing - ⚡ Single-binary delivery: the Go binary embeds
web/distand the HTML template, so no separate static deployment is required - 🔄 Live Reload: watches Markdown changes and updates the page through SSE
- 🔍 Full-text search:
Filestree file name search- Support for searching document content, including headers, code blocks, etc.
- 🧭 Dual sidebar navigation:
Filestree with expandable directories and current-file highlightingOn This Pagetable of contents with scroll spy
- 🔁 Inline navigation:
- file tree clicks do not trigger full page reloads
- in-document internal Markdown links are handled inline
- browser back/forward navigation is supported
- 📖 Split preview: hover over internal Markdown links to reveal a preview button, click to open the target document in a side-by-side panel
- 🎨 Rich rendering:
- GFM (GitHub Flavored Markdown)
- Image fullscreen viewer
highlight.jssyntax highlightingmermaid.jsrendering with source toggle and fullscreen viewer
- ⚙️ Reading preferences:
- page width presets
- font size increase, decrease, and reset
- settings persisted in
localStorage
- 📱 Responsive layout: sidebar-first reading on desktop, single-column layout on mobile
go install github.com/inhere/markview@latestInstall by Eget:
eget install inhere/markviewDownload and run markview:
# Preview the current directory (optional port; unset uses automatic project port)
markview [-p PORT]
# Preview a specific directory (default is current directory)
markview "path/to/docs"
# Preview a specific directory and set the default entry file (default entry is `README.md`)
markview "path/to/docs" "intro.md"
# Preview a single Markdown or HTML entry file
markview "path/to/docs/intro.md"
markview "path/to/docs/preview.html"
# Preview without recording the directory in the saved projects registry
markview --no-save "path/to/docs"A single .md, .html, or .htm file argument uses its parent directory as the serving root and opens that file as the default entry. Markdown files use the MarkView reader; HTML files are served directly from /, so their relative assets resolve beside the entry file.
When no port is specified, MarkView automatically chooses and remembers a project port, preferring 6100 when available. A normal start also records the directory in the saved projects registry, which --projects list and --global use. Pass --no-save for a temporary preview: the port is still picked up from the registry when the directory was saved before, but this run does not add or update the entry.
Start one local server for every project in the saved registry:
markview --globalThe global home page lists saved projects and opens each one under /p/{project-id}/. It binds to 127.0.0.1 by default; see Global server mode for routing, configuration precedence, registry refresh behavior, and the explicit public-listener option.
Example documents are available in example/.
You can adjust the port and default entry via .env / environment variables / options:
Using environment variables:
MKVIEW_PORT=8080 markview
MKVIEW_ENTRY=guide.md markview
MKVIEW_INCLUDE_DIR=.docs markview
MKVIEW_PREVIEW_EXTS=append:.html,.ini markview
MKVIEW_IFRAME_HOSTS=*.hyy.preview.test markview$env:MKVIEW_PORT = "8080"; markview
$env:MKVIEW_ENTRY = "guide.md"; markview
$env:MKVIEW_INCLUDE_DIR = ".docs"; markview
$env:MKVIEW_PREVIEW_EXTS = "append:.html,.ini"; markview
$env:MKVIEW_IFRAME_HOSTS = "*.hyy.preview.test"; markviewUsing project config, create markview.local.json, .markview.json, or markview.json in the project root:
{
"server": {
"include_dir": ".docs,.wiki"
}
}See docs/markview-json-example.md for a complete markview.json example.
server.include_dir and MKVIEW_INCLUDE_DIR allow selected skipped directories, including dot-prefixed documentation directories, to appear in the file tree. .git and node_modules are always skipped.
ui.preview_exts and MKVIEW_PREVIEW_EXTS configure file extensions opened in the preview panel. ui.iframe_hosts and MKVIEW_IFRAME_HOSTS configure external hosts that may open in the iframe preview panel; suffix rules such as *.hyy.preview.test or .hyy.preview.test match any subdomain.
Using CLI options:
markview -p 6543
markview . "guide.md"- Go 1.25+
- Bun 1.0+
markview/
├── web/ # Frontend source, template, and build output
│ ├── src/
│ │ ├── app.ts # Page lifecycle, navigation, orchestration
│ │ ├── sidebar.ts # File tree and TOC logic
│ │ ├── mermaid.ts # Mermaid enhancement and fullscreen behavior
│ │ ├── link-preview.ts # Split preview for internal Markdown links
│ │ ├── preferences.ts # Persisted reading preferences
│ │ └── live-status.ts # SSE connection status handling
│ ├── template.html # Main page template and CSS
│ ├── dist/ # Bun build output embedded by Go
│ └── package.json
├── main.go # Go server entrypoint
├── handlers.go # Cache header and handler helpers
├── example/ # Example Markdown documents
└── README.md
- Install web dependencies and build:
cd web
bun install
bun run buildThis generates web/dist/ and also copies:
highlight.csslogo.svgfavicon.svg
- Build the backend:
cd ..
go build --ldflags "-w -s" -o markview.exe
# Or install to GOPATH/bin
go install -ldflags "-s -w" .You can also use the provided Makefile:
make web
make build
make runUseful verification commands:
go test ./...
cd web && bun test ./src/*.test.ts
cd web && bun run build
go:embedpackages bothweb/template.htmlandweb/dist/into the final binary.
MIT