md-viewer

A no-dependency Markdown viewer for macOS Finder. Right-click a .md file → Quick Actions → View Markdown → it opens in your default browser as a split view: the rendered document on the left, the raw Markdown with syntax highlighting on the right.

Built for reading Markdown quickly without opening VS Code — sometimes the formatted view is clearer, sometimes the source is, so you get both at once.

There are two ways to use it:

  1. Finder Quick Action (macOS) — right-click a .md file locally.
  2. Web app — md.neckarshore.ai — drop, paste, or choose a .md in the browser. Fully client-side; nothing is uploaded.

Features

  1. Split view, always — rendered (left) and raw source (right) side by side.
  2. Syntax highlighting on the raw side — headings, bullets, bold, links and code fences are colour-coded so structure is visible in the source too.
  3. Auto light/dark — follows the macOS appearance setting.
  4. Self-contained & offline — the viewer is a single HTML file with all CSS and JS inlined. No internet, no npm, no runtime dependencies.
  5. Draggable divider — drag the middle bar to rebalance the two panes.
  6. Safe — rendered HTML is sanitized with DOMPurify, so a downloaded .md containing scripts cannot run code.

Install

git clone https://github.com/neckarshore-mmps/md-viewer.git
cd md-viewer
./install.sh

install.sh builds the pages, copies two Quick Actions into ~/Library/Services/, wires in the absolute paths to bin/mdview and bin/mdcompare, validates the plists, and refreshes the Services cache. ./uninstall.sh removes both.

# Quick Action Right-click on What it does
1 Compare a .pdf Converts the PDF with MarkItDown and Docling (only if its results are missing) and opens the comparison view with the PDF and both results already loaded
2 View Markdown a .md Opens the split view: rendered left, source right

Compare needs the converter set up once (it brings Python via uv):

cd converter && uv sync --extra docling

Results land in ~/md-converter/<doc>/ (change it with MD_CONVERTER_OUT); the PDF itself is never written. The first Docling run downloads its models (about 0.8 GB) and takes a minute; a notification says when it starts, a dialog says why if it fails.

If an entry does not appear, enable it under System Settings → Keyboard → Keyboard Shortcuts → Services → Files and Folders.

Usage

  • From Finder: right-click a .md → Quick Actions → View Markdown, or a .pdf → Quick Actions → Compare.
  • From the terminal: bin/mdview path/to/file.md, bin/mdcompare path/to/file.pdf

How it works

Piece Role
bin/mdview Base64-encodes the file contents + name (so no character can break the HTML), injects them into viewer.html, writes a temp file, and opens it.
viewer.html Self-contained template built by build.sh. Decodes the payload in-browser, renders the left pane with marked + DOMPurify, highlights the right pane with highlight.js.
quick-action/View Markdown.workflow Automator Quick Action that runs mdview on the selected file(s). Installed into ~/Library/Services/.
bin/mdcompare Finds uv (a Finder service has a minimal PATH), runs md-converter compare on the PDF, and turns a failure into a dialog.
quick-action/Compare.workflow Automator Quick Action for PDFs that runs mdcompare on the selected file(s).

Web app

The same viewer runs as a static, client-side web app in web/index.html (generated by build.sh), served at md.neckarshore.ai. It shares the split view with the Finder tool and adds:

  1. Two design themes — Minimalist (black/white/grey, system fonts) and Swiss Grid (IBM Plex, red accent, decorative left index rail, loud theme-scoped header/footer — the default). Pick via the nav dropdown (keyboard typeahead — type a theme's initial letter); the choice persists. Adding a theme is one token block + one dropdown entry.
  2. Light/dark toggle — per theme; initial state follows the system, the choice is remembered.
  3. README by default — the repo README renders on open; the readme.md button reloads it.
  4. Open dialog — the File System Access API (Chrome/Edge) defaults to the Downloads folder and remembers the last-used folder; falls back to a plain file input in Firefox/Safari.
  5. Responsive — under 640px the split stacks vertically (rendered on top, source below).
  6. Synced scrolling — scrolling either pane drives the other proportionally.
  7. Fixed footer + drag-and-drop + paste, all fully client-side.
  8. Compare view at /compare: open one PDF and the Markdown or text results of your PDF converters and read them side by side. Two result panes, each with a selector, so any number of tools fits; with one result it is a plain PDF and Markdown view. Desktop only, and nothing is uploaded either.

Fonts are self-hosted (web/fonts/), so the app stays offline-capable. Themes are web-app only — the Finder tool keeps its GitHub styling.

  • Deploy: merges to main auto-deploy to production (Vercel project md-viewer, root dir web, git-connected).
  • DNS: md.neckarshore.ai is a CNAME → cname.vercel-dns.com at the domain's DNS host (Hostinger), matching the existing www record.

PDF converter

The results the compare view shows come from a separate command-line program in converter/: md-converter turns PDFs into Markdown with MarkItDown and Docling, locally and free, one result per tool next to a copy of the PDF. The viewer itself never converts anything.

md-converter compare <pdf> is what the Compare Quick Action runs: it converts if needed and writes a local copy of web/compare.html with the PDF and its results embedded, then opens it in the default browser. On Windows the same command works from the Explorer Send to menu; the how-to is in the converter README.

Rebuilding after edits

The committed viewer.html is generated. After editing anything in src/ or updating a vendored library in vendor/, rebuild it:

./build.sh

Updating vendored libraries

Pinned versions live in vendor/ (see docs/vendor-sources.md for the exact URLs and versions). Re-download, then ./build.sh.

Testing

./test/smoke.sh

End-to-end smoke test: builds the viewer, runs mdview on a fixture, and asserts the output is well-formed (placeholders resolved, payload embedded, libraries inlined, missing-file rejected).

Estate test-scope stats

This repo is a producer for the neckarshore.ai estate test count. On every push:main, CI counts the five gated suites and publishes a contract-valid stats.json to the dedicated stats-data branch, not to main. main is protected (PRs plus the smoke and e2e checks), so a bot cannot push to it; the machine artifact lives on its own unprotected data branch instead. The aggregator fetches it with ?ref=stats-data (statsRef in the website's stats-config.json). Contract: stats-json-contract.md.

Uninstall

./uninstall.sh

Backlog (deliberately not in v1)

  1. Synchronized scrolling between the two panes.
  2. Configurable / switchable themes beyond auto light/dark.
  3. Mermaid diagram and LaTeX math rendering.
Drop to open ⬇︎