A browser-based Markdown viewer with mq query support. Start a local server from the CLI, open your Markdown files in the browser, and filter or transform them with mq queries in real time.

Features
- Browser viewer: Renders Markdown in the browser with GitHub-style styling
- mq queries: Filter and transform Markdown with mq syntax (e.g.
.h,.code) - Mermaid diagrams: Renders
```mermaidcode blocks as diagrams automatically - Syntax highlighting: Code blocks highlighted
- GitHub alerts:
> [!NOTE],[!TIP],[!IMPORTANT],[!WARNING],[!CAUTION]render as colored admonitions - Zoom: Click an image or a rendered Mermaid diagram to view it fullscreen
- Themes: Switch instantly between Light, Dark, System, Solarized, Dracula, Nord, Monokai, Rosé Pine
- Font size: Adjust preview text size from the toolbar
- File watch: Detects file changes and reloads the browser automatically
- Persistent background server: Runs until you explicitly stop it — closing every browser tab does not shut it down
- Multi-server aware:
--statuslists every mq-serve server running on the machine, regardless of port or working directory
Installation
Quick Install
|
The installer will:
- Download the latest mq binary for your platform
- Install it to
~/.local/bin/ - Update your shell profile to add mq to your PATH
Cargo
Usage
mq-serve runs in the background by default — the command returns immediately and the shell is free straight away.
# Current directory (background, opens browser)
# Specific files or directories
# Second call adds files to the already-running server
# Pipe content from stdin
|
|
# Custom port
# Bind to all interfaces (e.g. inside Docker) — requires an explicit opt-in,
# since mq-serve has no authentication and anyone reaching the address can read your files
# Run in the foreground (e.g. in a container or for debugging)
# Assign files to a named sidebar group
Open http://localhost:7700 in your browser (opened automatically by default).
Single server, multiple files
If a server is already running on the given port, subsequent mq-serve invocations add files to the existing session instead of starting a new one.
To use a completely separate session, use a different port:
Persistent background servers
A background server keeps running until you explicitly stop it — closing every browser tab no longer shuts it down. Use --status from anywhere (any directory, any port) to see everything currently running:
http://127.0.0.1:7700 (v0.1.13, pid 51203)
3 file(s)
http://127.0.0.1:7701 (v0.1.13, pid 51298)
1 file(s)
Once you know a port from the list above, open, add to, or stop that specific server from anywhere:
Restarting, clearing and removing files
Options
Arguments:
[FILES_OR_DIRS]... Markdown files or directories to serve. Defaults to the current directory
Options:
-t, --target <NAME>
Assign the given files/directories to a named group in the sidebar
-p, --port <PORT>
Port to listen on [default: 7700]
-b, --bind <BIND>
Address to bind to [default: 127.0.0.1]
--dangerously-allow-remote-access
Required together with a non-loopback --bind to confirm the server should be reachable from the network (it has no authentication)
--no-open
Do not automatically open the browser
--open
Always open the browser, even when adding files to an already-running server
--no-watch
Disable file-change watching
-f, --foreground
Run in the foreground instead of the background (default is background)
--stop
Stop the background server running on the given port
--stop-all
Stop every background mq-serve server currently running
--restart
Restart the background server running on the given port
--status
Show running server(s). With no other selector, lists every mq-serve server currently running on this machine, regardless of port
--json
Output --status as JSON instead of human-readable text
--clear
Clear the saved session for the given port. If a server is running it will be restarted with an empty session
--close <PATH>...
Remove one or more files/directories from the running session on the given port
--unwatch <PATH>...
Stop watching one or more files/directories on the running session on the given port. Alias for --close
-h, --help
Print help
-V, --version
Print version
mq Query Examples
| Query | Effect |
|---|---|
.h |
Extract all headings |
.code |
Extract all code blocks |
.p |
Extract all paragraphs |
.h | upcase() |
Extract headings and convert to uppercase |
Enter a query in the bar at the top of the page and press Enter. Click Clear to reset to the original content.
Development
License
MIT