Markport — local Markdown viewer for AI agent output

Markport logo

日本語 · Repository · Releases

Markport is a local, read-only Markdown viewer that opens a folder in your browser to review AI agent output. Preview Markdown, HTML, code, images, and PDFs side by side, and inspect Git diffs and history. Point the CLI at a directory to start browsing without changing any files.

Markport showing a Markdown file and content search results

Highlights

More screenshots

Markport Git review showing changed files and review status

Markport split view comparing two Markdown files

Markport previewing pasted Markdown without creating a file

Markport Markdown preview and content search in the dark theme

Markport Markdown viewer on a narrow mobile screen

Contents

Install

Linux installer

Install the latest release for your CPU:

(
  installer=$(mktemp) || exit
  trap 'rm -f "$installer"' 0
  trap 'exit 1' 1 2 3 15
  curl -fsSLo "$installer" https://raw.githubusercontent.com/yomon8/markport/main/scripts/install-linux.sh &&
    sh "$installer"
)

The installer places markport in ~/.local/bin and leaves no installer script behind. It verifies the release checksum before replacing the binary, so a failed download or check keeps the installed version. Run the same command again to upgrade. Add ~/.local/bin to your PATH if needed.

Manual download

Download the executable for your OS and CPU from the GitHub Releases page. Builds are available for Linux, macOS, and Windows on amd64 (x64) and arm64; the Windows executable has a .exe extension. Release binaries are not code-signed or notarized on macOS.

To verify a download, place checksums_<version>.txt from the release next to the executable and run:

sha256sum --check checksums_<version>.txt      # Linux
shasum -a 256 -c checksums_<version>.txt       # macOS

On Windows, use Get-FileHash to check an individual file. On Linux and macOS, rename the downloaded file to markport and make it executable with chmod +x markport.

Quick start

markport ./notes

Open the http://127.0.0.1:3000/ URL printed at startup. Omit the directory to browse the current directory. Press Ctrl+C to stop.

Option Description
[directory] Folder to browse. Defaults to the current directory.
--host IPv4 Address to listen on. Defaults to 127.0.0.1. See LAN access.
--lan Alias for --host 0.0.0.0. Cannot be combined with --host.
--port PORT Port to listen on. Defaults to 3000.
--auto-port Let the OS assign an available port. Cannot be combined with --port.
--title TEXT Fixed browser tab title. See Browser tab title.
--manage-servers Enable switching to an installed version from this server’s Server info.
--help Show usage.
--version Show the version.
--list-servers List running Markport servers for this OS user on this host.
--json Output the server list as JSON. Requires --list-servers.
--check-update, --update Check for or install a newer release. See Updating.

Options that take a value also accept the --name=value form, for example --port=8080.

To start without choosing a port, use --auto-port and open the URL printed at startup. The port may change each time you start Markport. Combine it with --lan to allow LAN access:

markport ./notes --auto-port
markport ./notes --lan --auto-port

Using Markport

Click a folder in the file’s breadcrumb path to reveal it in the sidebar, use Collapse all beside Search files to close all open folders, and drag the sidebar divider to adjust its width. Markdown files with three or more headings show a Contents outline that highlights the current section.

To link to a fixed location in Markdown, put <a id="recovery"></a> on its own line and link to it with [Jump to recovery](#recovery). IDs are case-sensitive and can contain letters, marks, numbers, and -, _, ., or :. The tag must be empty and have no other attributes. Raw HTML remains disabled in Markdown previews except for these anchors and line breaks in table cells. In the main pane, links from other Markdown files and direct URLs with the fragment also work. In the right pane and Paste Markdown, these links jump within the same preview. Explicit anchors are not supported in print or PDF output.

Search files matches file names and paths, including files inside closed folders. Git-ignored files remain searchable but rank below other matches. Append a positive line number, such as path/to/file.md:123, to jump to that line. Markdown and HTML line targets open in Source view.

Open Search contents, enter Text to find, and optionally set Folder to a path relative to the browsing directory (leave it empty to search everything). Results show matching lines with context; click one to open that line. Use Cancel to stop a search. If a search limit is reached, the message names the limit and notes that results are partial.

Use Aa to match case, ab to match whole words (including Unicode letters and digits), and .* for single-line regular expressions using Go’s RE2 syntax. Invalid expressions show an error beside the search results. Files to include and Files to exclude accept up to 20 comma-separated patterns each, such as *.md, docs/**; patterns without / match file names, and ** matches zero or more directories. Exclusions take priority. These options are saved in this browser.

Content search skips Git-ignored files by default and reports how many were skipped. Enable Include ignored files to search them after other files. If Git is unavailable, all browsable files are searched. Searches stop after 30 seconds and return partial results when the time or another search limit is reached.

Split view

Use the arrow beside a file in the sidebar or a search result to open it on the right. Each pane scrolls and refreshes independently. Click a pane or focus a control inside it to select it as the file destination; its title shows Active. Files and file/content search results open in the selected pane. Open on right always opens on the right. Use Swap panes to exchange the files, Show this file only to keep only the right file, or Close split view to return to the left file. Drag the divider to resize the panes, or focus it and use the left/right arrow keys. Double-click it to restore equal widths. The ratio is saved in this browser. On narrow screens the panes stack vertically.

Markdown content width

Use the Content width icon in a Markdown title bar to choose Standard (46em), Wide (64em), or Full (the available pane width, the default). Existing saved choices are retained. Press Shift+W to cycle Full → Standard → Wide → Full while the width control is visible, outside text entry, dialogs, and menus. The choice is saved in this browser per host and port and applies to both split panes and the Rendered/Split previews in Paste Markdown. The width control is hidden on screens 700px wide or narrower; your saved choice is retained. Paste’s text editor width is a separate setting.

Tables, code blocks, and Mermaid diagrams stay within the same column as the text. Use Full to give them the available pane width. Overflow scrolls inside the block, and the wrapping and Expand controls remain available. Source views and print layouts keep their existing widths.

Code, tables, Mermaid diagrams, and LaTeX math

Use Wrap lines in a code block or source view to wrap long lines, and Copy to copy the code. Markdown tables have Copy to copy their original Markdown, plus Wrap cells and Expand for wide tables; wide tables scroll horizontally and show edge hints when more content is available. Wrapping choices are saved in this browser and apply to both split panes and pasted Markdown.

To force a line break inside a Markdown table cell, write First line<br />Second line on the same source line. The break works even when Wrap cells is off.

Mermaid diagrams have Copy, Source, and Expand controls. Copy copies the diagram definition without code fences. In the expanded view, drag to pan, use the zoom buttons or a pinch gesture to zoom, and choose Fit diagram or 100% to reset the scale.

Diagrams use the document font, soft theme colors, and balanced spacing. Screen themes apply to diagrams; print previews use a neutral palette on white.

Math is rendered with bundled KaTeX, with no CDN or internet connection required, in Markdown previews, both split panes, and Paste Markdown. Use $E=mc^2$ or \(E=mc^2\) for inline math, and $$E=mc^2$$ or \[E=mc^2\] for display math, which can span multiple lines:

$$
\int_0^1 x^2\,dx = \frac{1}{3}
$$

Display formulas have Copy to copy their original TeX, including the $$…$$ or \[…\] delimiters. If a diagram or formula cannot be rendered, its source is shown with an error and remains copyable, and the rest of the document stays readable. Code, diagram, table, formula, and expanded-view tools use icon buttons; hover over or focus a button to see its action name. Wrapping buttons are highlighted when enabled. Copy briefly shows a checkmark with Copied, or a cross with Copy failed, and announces the result to screen readers. These controls are omitted from print output.

HTML and PDF previews

HTML previews can load relative CSS and images from the browsing directory, plus external CSS and images. JavaScript is off by default. For an HTML file you trust, click Enable JavaScript to run inline and local scripts, including interactive controls and printing. The choice applies to that file in the current tab until you click Disable JavaScript, close the tab, or restart Markport. Scripts run in an isolated preview; external scripts, fetch and WebSocket calls, form submission, and access to the Markport UI remain blocked.

PDFs use your browser’s built-in viewer and can also be opened in a new tab or downloaded.

Choose Print / Save as PDF from the file actions, either split pane, or Paste options in Paste Markdown; it also works from Source and Text views. A dialog shows the printable document on a white background with rendered Mermaid diagrams and formulas. When it is ready, click Print / Save as PDF and choose Save as PDF in your browser’s print dialog, where you can also set paper size, orientation, headers and footers, and check page breaks.

Each operation prints one document, captured when it is loaded for printing (or the current input for Paste Markdown). Rendering errors are included with a warning. Closing the dialog returns to your original view.

Paste Markdown

Click Paste Markdown to open a full-size editor for Markdown that is not in a file.

Git review and history

Git views require Git and a browsing directory inside a Git repository. If you browse a subfolder, changes and history are limited to that folder.

Changes compares working files with HEAD by default, including staged, unstaged, and untracked changes. To use another base, pick a recent commit in Compare with current from or enter a full or abbreviated commit ID, then click Compare; you can also choose Compare with current from History. The commit must be reachable from HEAD, and abbreviated IDs must be unambiguous and at least seven hexadecimal characters. Use HEAD restores the default.

The Changes overview shows file counts, added and deleted lines, and review progress. Use Folder tree to group changes by directory and Unreviewed only to focus on remaining files. Mark reviewed records the current revision of a file; a later change makes it unreviewed again. Marks are saved in this browser per browsing root and comparison base. In Diff view, use Previous, Next, or Review and next (or p, n, r) to move through the review.

The main list, sidebar, and Diff heading use Lazygit-style two-character status codes: the left column describes staged changes (green), and the right column describes unstaged changes (red). For example, M is a staged modification, ` M is an unstaged modification, MM contains both, A ` is a staged addition, AM is an addition edited after staging, D / ` D are staged / unstaged deletions, ?? is untracked, and UU, AU, or DU` indicate conflicts. Status is always relative to the current HEAD, index, and working tree, including during older-commit comparisons; committed differences alone have blank status columns. Hover or use a screen reader for the status explanation and comparison change type. If Git returns multiple statuses for one path, each pair appears on the same row. Files whose staged and unstaged changes cancel out remain listed, with zero net lines and an explanation in Diff. Changes to file contents, executable permissions, or staging status invalidate review marks.

History lists commits that changed the current folder. Each commit’s diff shows what that commit changed, while Compare with current compares that commit with the files on disk now.

For an individual file, use File / Diff / History / Blame above the content. History follows Git-detected renames within the browsing root; select a commit to switch between its Diff and the Source at that time. Older commits load in pages of 50. Historical Source is a text view with line numbers and syntax highlighting, using the available pane width.

Blame annotates the current working-file source with commit, author, and date. Staged and unstaged edits are marked Uncommitted; new files have all lines marked that way. Click a commit ID to view the source at that commit and its original path. In narrow panes, author and date move into the information button’s Last change dialog to leave more room for source; long lines scroll horizontally within the source area. Text files only are supported, subject to the existing size limits. Both split panes have independent views, and swapping panes or showing one file preserves their selection. On mobile, use each pane’s File actions menu.

Server info

Click Server info (ⓘ) in the header or press Ctrl+I to see the browsing folder’s absolute path (with symbolic links resolved), the working directory at startup, the Markport version, the connection URL, and the process ID (PID).

Running Markport servers lists servers started by the same OS user on this host, with their folders, URLs, versions, PIDs, and Git branches when available. For a detached HEAD, it shows the short commit ID. The current server is listed first and marked Current. Click a folder link, or select it with ↑ / ↓ and press Enter, to open that server in the same tab. Filter by directory, branch, or PID is focused when the dialog opens. Type any part of a directory path, branch name, detached HEAD commit ID, or PID to filter the list. Matching is case-insensitive. While typing, use ↑ / ↓ to select a candidate and Enter to open it. Refresh updates the list while keeping the filter; closing and reopening clears it.

If the server stops responding while the tab is open, use Show last known servers in the connection notice to choose another server in the same tab. The list lives only in the open tab. It can be filtered by directory or branch, but does not show or match PIDs. A candidate that responds is reachable but has not been verified as Markport. If a different Markport starts on the same port, Use this server switches the notice and list to the new instance.

You can also retrieve the list from the CLI without starting a server:

markport --list-servers
markport --list-servers --json

The default output is a table with URL, VERSION, and DIRECTORY columns. JSON output is an array of objects:

[{"rootPath":"/home/user/notes","url":"http://127.0.0.1:3000/","version":"v0.11.0"}]

Both formats sort servers by browsing directory, port, and URL. CLI URLs connect from this machine; servers listening on 0.0.0.0 use 127.0.0.1 in the URL. With no running servers, the command prints No running Markport servers found. (or [] with --json) and exits successfully. Discovery failures are reported on standard error with exit code 1, without printing a partial list. --list-servers cannot be combined with a directory, startup options, update flags, or --version.

Restart a server with an installed update

Start the server you want to manage from with markport ./notes --manage-servers. For LAN access, add --lan. Open the ordinary browsing URL and open Server info. On the LAN, enter the Server management code printed in the startup terminal and choose Unlock once per tab. The code does not go in the URL. Only use LAN management on a trusted network because HTTP is not encrypted.

After you install a newer stable Markport at the same location, Server info shows the current and installed versions side by side and offers Switch version… only where the installed version is newer. Use Refresh if the dialog was already open. Review the target directory and versions, then select Restart and switch. You can switch another server or Current, one at a time. The other servers do not need the startup option, but they must be running a version that supports the handoff. The folder, working directory, title, and URL stay the same, even with --auto-port. For Current, the connection pauses briefly. After success, choose Reload to use new version.

Development builds can manage other servers with --manage-servers, but only supported stable builds can be switched to a newer version. Restart development builds and older unsupported servers manually. If a replacement fails to start, Markport tries to resume the previous server. The original launcher stays attached to its terminal, where Ctrl+C still stops the server. To update the launcher itself, stop it and start Markport again.

Color themes

Choose Theme in the header (under App settings on mobile):

Theme Look
Auto Follows your OS light/dark preference
Light / Dark Default palettes
Sepia Warm colors for reading
Nord Dark blue-gray
Catppuccin Mocha Pastel accents on a dark background
Solarized Light Cream and teal
Rosé Pine Dawn Warm paper tones
Tokyo Night Deep blue with purple and blue accents
Tokyo Night Light Cool gray with blue and purple accents
GitHub Light White and light gray with blue accents
GitHub Dark Dimmed Muted dark gray with soft syntax colors

Themes also apply to code highlighting, Git diffs, and Mermaid diagrams. HTML previews keep the document’s own colors; PDFs and images keep their original appearance. The choice is saved in this browser per host and port.

Sepia · Nord

Browser tab title

Set a fixed tab title at startup:

markport ./notes --title "Work notes"

You can also set Title in the header (under App settings on mobile). A title saved in the browser overrides --title, stays fixed while you switch files, and is saved per browsing folder and host/port. Changes apply to other open tabs using the same setting and survive reloads and server restarts. Use Reset or save an empty value to fall back to the startup title; with neither set, the tab shows the current file or screen name.

Keyboard shortcuts

Press ? or the help button in the header to see shortcuts in Markport. On macOS, use ⌘ instead of Ctrl.

Keys Action
/ or Ctrl+K Focus file search
Ctrl+B Toggle the file list
Ctrl+I Open Server info
Shift+M Open Paste Markdown
Shift+T Open the theme menu; use arrows or Home / End to move, Enter / Space to select, Esc to close
Shift+W Cycle Content width: Full → Standard → Wide → Full
? Show keyboard shortcuts
Esc Close a dialog or menu; clear file search
n / p Next / previous changed file in Diff view
r Mark reviewed and open the next unreviewed file
↑ / ↓, Home / End Move through visible folders, files, and page-loading controls
← / → Collapse / expand a folder or move to its parent / first child
Enter Open a file, toggle a folder, or load more items
Tab / Shift+Tab Enter / leave the file tree; the current file’s Open on right button is also reachable
← / →, Home / End Switch sidebar tabs
↑ / ↓, Enter Select and open a running server in Server info
Ctrl+Enter, Tab / Shift+Tab, Esc Switch views, indent, and leave the editor in Paste Markdown

In Files and filename search results, arrow keys move focus without changing the preview. Opening a file with Enter keeps focus in the list, including on narrow screens, so you can keep browsing. Search results remain until you clear the search; Esc in the search field or results clears it and returns focus to the search field. In the search field, ↓ / ↑ focuses the first / last item, and Enter opens the first result. You can collapse a folder containing the displayed file without changing its content; it stays collapsed during refresh and reload. Opening another file or using a directory breadcrumb reveals the required folders.

Global shortcuts do not interrupt text entry or IME composition.

Vim navigation is always enabled: j/k scroll the active reading pane by 40px, Ctrl+D/Ctrl+U by half a page, and gg/G jump to the start/end. In the focused file tree, h/j/k/l navigate folders and rows, gg/G select the first/last row, and Enter opens. Type gg within 800ms. These keys are inactive in inputs, menus, dialogs, and Paste Markdown. Half-page keys use Ctrl on macOS too. / still searches files.

Updating

Versions that support self-update can update themselves:

markport --check-update   # Show the current and latest stable versions
markport --update         # Download, verify, and install a newer stable release
Failure recovery details Download and verification failures leave the installed executable in place. On Windows, the old executable is renamed before the new one is installed, and a failed installation attempts to restore it. If a running process prevents deletion of the previous executable, its path is printed so you can remove it and its staging directory after all old processes exit. If the update is forcibly terminated during replacement and the original path is missing, move `previous.exe` from the adjacent `.-update-*` directory back to the original path. A failed restore reports the recovery paths. The small `..update.lock` file stays in the installation directory to coordinate updates; its lock is released when the updater exits. </details> ## LAN access and security By default, Markport listens only on `127.0.0.1`. To let devices on the same LAN connect, start it with `--lan`, `--host 0.0.0.0`, or a specific IPv4 address and open `http://:/` on those devices: ```sh markport ./notes --lan --port 3000 ``` > [!WARNING] > LAN mode has no authentication or TLS. Anyone who can reach the port can browse the selected directory, including dotfiles other than the excluded directories. ## Limits and refresh behavior - `.git`, `node_modules`, and `.venv` are excluded from browsing; other dotfiles are visible. - Symbolic links, Windows junctions, and special files such as FIFOs are not read. - Text files are limited to 10 MiB and images to 32 MiB. Binary or unreadable files show an error for that file only. - Folders load when opened, 200 entries at a time. File search covers all browsable files and shows the top 100 matches. - Linux and Windows use filesystem notifications and server-sent events to refresh open folders, the selected file, and Git views shortly after changes. A 30-second poll provides a backup check. While searching file names, creation, removal, and rename notifications also refresh the file index, with a 30-second backup refresh. - macOS always uses polling. If native watching is unavailable, registration fails, the 8,192-directory watch limit is exceeded, the native event queue overflows, or the event stream disconnects, views fall back to three-second polling. File name lists refresh every ten seconds while searching in polling mode. Closed folders refresh when opened. Click **Refresh** in the header to fetch the latest state immediately. Markport does not edit files, add comments, read from standard input, or provide authenticated network hosting. ## Development ### Architecture The Go executable serves the embedded browser UI and a read-only API on the configured IPv4 address. It renders files on demand and lists one folder at a time. ```mermaid flowchart LR user["User"] -->|"Opens local URL"| browser["Browser UI"] browser <-->|"HTTP / SSE (with polling fallback)"| server["Markport (Go)"] server -->|"Read selected files and folders"| directory["Selected directory"] ``` | Path | Role | | --- | --- | | `cmd/markport/` | Entry point | | `internal/cli/` | Argument parsing | | `internal/files/` | Safe filesystem access and watching | | `internal/render/` | HTML rendering | | `internal/server/` | HTTP server | | `internal/gitdiff/` | Git changes and history | | `internal/discovery/` | Running server discovery | | `internal/update/` | Self-update | | `web/src/` | TypeScript UI and CSS (built into `internal/web/dist/`) | | `testdata/` | Sample content for browsing | ### Commands Development requires Go 1.27, Node.js 24, npm, and Make. The devcontainer forwards ports 3000 and 5173. The web build and type checks use TypeScript 7 through the `@typescript/native` npm alias, which provides `tsc`. The `typescript` dependency aliases `@typescript/typescript6` to provide the compiler API required by `typescript-eslint`. ```sh make setup # Download Go modules and install npm dependencies make dev DIR=./testdata # Start the Go API and Vite at localhost:5173 make build VERSION=dev # Build an executable for the current OS and CPU make run DIR=./testdata PORT=3000 make run DIR=./testdata HOST=0.0.0.0 PORT=3000 # Allow LAN access make test # Run Go and UI tests make test-e2e # Run Chromium browser tests make screenshots # Regenerate the README screenshots make lint # Run go vet, TypeScript checks, and ESLint make dist VERSION=v1.0.0 # Build six executables and SHA-256 checksums ``` After `make setup`, you can run `make lint` on its own. Each relevant Make target builds the web UI and embeds it in the executable. During development, Vite proxies API requests to Go. Before running `make test-e2e` or `make screenshots` for the first time, install Chromium and its libraries with `cd web && npx playwright install --with-deps chromium`. ### CI and releases Pull requests run CI on Linux, macOS, and Windows, with Chromium browser tests on Linux; ordinary branch pushes do not run CI. Pushing a `v*` tag makes GitHub Actions validate each OS build and create a release for that tag. Before releasing, you can run `make test`, `make lint`, `make test-e2e VERSION=`, and `make dist VERSION=` locally. Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/).